#12: Arduino code to Johnny-five code
To control my robot I want a gsm with some buttons, like I discussed in my blogpost #7. But to do that I can't keep using Arduino code, I will need to transform my Arduino code to a code that is understandable for Javascript to use. So that is where Johnny-five comes in, Johnny-five is an JavaScript Robotics & IoT Platform. Easy to implement and to use. Just install Johnny-five by using, in my case, yarn add Johnny-five. And then on the server side require the package and make a new board instance. After doing that I needed to declare the controller, which is my Arduino Adafruit Servo shield, the PCA9685. Here is an example of Johnny-five self; http://johnny-five.io/examples/servo-PCA9685/. Now I can declare my servo's and the pins they connect to.
From there on I started to transform my Arduino code to Johnny-five code. The most difficult part of transforming the code was finding a way to replace the delay() function from Arduino, so after surfing the web for a bit I found this solution.

As you can see the movements where he stands still, he does almost perfectly. But as soon as he starts to walk it looks like he is having a seizure. That is a problem I need to fix.








Opmerkingen