UPDATE: Johnny-Five is fully working now! read more about it here!
Our next step: Repeat our current achievements from a Raspberry Pi connected to our Arduino board.
First of all, you obviously need to install Node.js in your Raspberry Pi. To do that, I followed the step “Installing Node.JS” from this post. I ignored the steps for changing the IP address to a static address and the start script, as we will cover (and go further) these aspects when turning our Raspberry Pi into an AP.
So now, with Node.js running in my Raspberry Pi, I promptly plugged my Arduino board, set the classic 13-pin-led configuration and the code we saw in the last post:
1 2 3 4 5 6 7 8 9
And…. it didn’t work.
After some debugging I found that the Board.js file from Duino, when searching for the serial port where the Arduino is supposed to be plugged, runs this code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
More precisely, this line:
This command was returning… nothing, so the Board class wasn’t able to see where was the Arduino plugged. The problem is that our Arduino board, when plugged into our Raspberry Pi, will appear (at least in my Rpi), as ttyACM0 or ttyACM1, and the grep command as it is, will not return any suitable device.
I forked the project to make some experiments (you can find my fork here), and replaced the grep command for
And bang! it worked!
Next step?: Deploy a full Node.js server into our Raspberry Pi to offer a proper HTML5 interface to control our Arduino board and set the Raspberry Pi as an AP so that we can connect to it.
We’ll talk about this in our next post :D