In the previous post I said it would be more expensive to implement a Firmata based approach. I was wrong. Firmata SYSEX command set is quite easy to extend actually.
Extending Firmata on Arduino
I was strolling on google when a wild tutorial appears. Thanks to this piece of example which encouraged me to give Firmata a try.
I was previously looking at Johnny-five’s code and was properly scared off. The complexity is just too damn high.
However we are not toying with Johnny-five this time, just plain old Firmata.
First we open up the StandardFirmata ino file and insert this code:
Also insert the readCapacitivePin function to the end of the file. You can find the code in this post.
Extending Firmata Nodejs client
You can get your firmata module from npm.
Once you have installed the module, go to its directory and find lib/firmata.js.
Add the following code:
Testing
You can type in board.queryPinCapacitance(13) and try it out. Board setup is easy:
Image curtesy to Arduino
Firmataized Fruit Piano
Here is your Helper App code
Ready to Go
You can just use the Scratch project in the previous Fruit Piano Scratch project. The Scratch project is athogonal to our Helper App implementation hence no change is needed.