75 lines
5.0 KiB
Markdown
75 lines
5.0 KiB
Markdown
#ConfigurableFirmata
|
|
|
|
[](https://gitter.im/firmata/ConfigurableFirmata?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
|
|
|
Firmata is a protocol for communicating with microcontrollers from software on a host computer. The [protocol](https://github.com/firmata/protocol) can be implemented in firmware on any microcontroller architecture as well as software on any host computer software package. The arduino repository described here is a Firmata library for Arduino and Arduino-compatible devices. If you would like to contribute to Firmata, please see the [Contributing](#contributing) section below.
|
|
|
|
##Installation
|
|
|
|
- **If you are using Arduino IDE version 1.6.4 or higher** go to `Sketch > Include Library > Manage Libraries` and then search for "ConfigurableFirmata" and click on `Install` after tapping on the ConfigurableFirmata item in the filtered results. You can also use this same method to update ConfigurableFirmata in the future.
|
|
- **If you are using an older version of the Arduino IDE**, download or clone ConfigurableFirmata to your Arduino sketchbook library folder. This is typically `/Documents/Arduino/libraries/` on Mac or Linux or `\My Documents\Arduino\libraries\` on Windows.
|
|
|
|
##Usage
|
|
|
|
ConfigurableFirmata is a version of Firmata that breaks features such as Digital Input, Digital Output, Analog Input, Analog Output, I2C, etc into [individual classes](https://github.com/firmata/ConfigurableFirmata/tree/master/src) making it easier to mix and match standard features with custom features.
|
|
|
|
The easiest way to use ConfigurableFirmata is with [firmatabuilder](http://firmatabuilder.com) which is a simple web application that generates an Arduino sketch based on a selection of Firmata features. Download the generated sketch, compile and upload it to your board.
|
|
|
|
Another way to use ConfigurableFirmata is by adding or removing various include statements in the [ConfigurableFirmata.ino](https://github.com/firmata/ConfigurableFirmata/blob/master/examples/ConfigurableFirmata/ConfigurableFirmata.ino) example file.
|
|
|
|
##Firmata Wrapper Libraries
|
|
|
|
You can use the ConfigurableFirmata architecture to wrap 3rd party libraries to include
|
|
functionality not included in the base ConfigurableFirmata.ino example. See [FirmataEncoder](https://github.com/firmata/FirmataEncoder) for an example of a Firmata wrapper. To include a Firmata wrapper your
|
|
ino file, you must install both the sketch and the 3rd party library into your `/Arduino/libraries/`
|
|
directory (where all 3rd party libraries are installed).
|
|
|
|
When creating a new Firmata wrapper library, you generally should not include the 3rd party
|
|
library it wraps. For example, the Encoder library that FirmataEncoder wraps is not included with
|
|
the FirmataEncoder library.
|
|
|
|
If you create a wrapper library, prepend the name with 'Firmata'. Hence 'FirmataEncoder' in the
|
|
referenced example. This will keep the wrapper libraries together in the user's Arduino libraries
|
|
directory.
|
|
|
|
A Firmata wrapper template library will be published soon along with instructions for creating
|
|
a wrapper library.
|
|
|
|
##Firmata Client Libraries
|
|
Only a few Firmata client libraries currently support ConfigurableFirmata:
|
|
|
|
* javascript
|
|
* [https://github.com/jgautier/firmata]
|
|
* [https://github.com/rwldrn/johnny-five]
|
|
* [http://breakoutjs.com]
|
|
* perl
|
|
* [https://github.com/ntruchsess/perl-firmata]
|
|
|
|
*Additional Firmata client libraries may work as well. If you're a client library developer and have verified that you library works with ConfigurableFirmata, please [open an issue](https://github.com/firmata/ConfigurableFirmata/issues) with a request to add the link.*
|
|
|
|
<a name="contributing" />
|
|
##Contributing
|
|
|
|
If you discover a bug or would like to propose a new feature, please open a new [issue](https://github.com/firmata/ConfigurableFirmata/issues?sort=created&state=open).
|
|
|
|
To contribute, fork this repository and create a new topic branch for the bug, feature or other existing issue you are addressing. Submit the pull request against the *master* branch.
|
|
|
|
You must thoroughly test your contributed code. In your pull request, describe tests performed to ensure that no existing code is broken and that any changes maintain backwards compatibility with the existing api. Test on multiple Arduino board variants if possible. We hope to enable some form of automated (or at least semi-automated) testing in the future, but for now any tests will need to be executed manually by the contributor and reviewers.
|
|
|
|
Use [Artistic Style](http://astyle.sourceforge.net/) (astyle) to format your code. Set the following rules for the astyle formatter:
|
|
|
|
```
|
|
style = ""
|
|
indent = "spaces"
|
|
indent-spaces = 2
|
|
indent-classes = true
|
|
indent-switches = true
|
|
indent-cases = true
|
|
indent-col1-comments = true
|
|
pad-oper = true
|
|
pad-header = true
|
|
keep-one-line-statements = true
|
|
```
|
|
|
|
If you happen to use Sublime Text, [this astyle plugin](https://github.com/timonwong/SublimeAStyleFormatter) is helpful. Set the above rules in the user settings file.
|