Running our motors project

Load the project onto the Pi, and navigate to the folder in the Pi SSH session. Then, run: 

sudo node driver-bot.js

Once you see Board Initialized, feel free to try out our new functions:

goForward(100) // start moving both motors forward
stop() // and stop
goBackward(50) // go backward at half the previous speed
stop()
goForward(100)
turnRight(100)
turnLeft(200) // a faster left turn
spinRight(255) // robots can't get dizzy, maximum fastness
spinLeft(100)
stop()

And that's it—you've written all the code you need to drive a two-wheeled robot!

As a bonus project, think of a way you could drive the bot without having to type out the function names each time!

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.69.255