Book Image

Hands-On Robotics with JavaScript

By : Kassandra Perch
Book Image

Hands-On Robotics with JavaScript

By: Kassandra Perch

Overview of this book

JavaScript has an effective set of frameworks and libraries that provide support for embedded device programming and the robotics ecosystem. You’ll be able to put your JavaScript knowledge to work with this practical robotics guide. The book starts by guiding you in setting up an environment to program robots with JavaScript and Rasberry Pi 3. You will build beginner-level projects, such as a line-following robot, and then upgrade your robotics skills with a series of projects that help you get to grips with the Johnny-Five library. As you progress, you’ll learn how you can improve your projects by enabling advanced hardware components and programming concepts. You’ll even build an advanced AI-enabled robot, connect its NodeBots to the internet, create a NodeBots Swarm, and explore Message Queuing Telemetry Transport (MQTT). By the end of this book, you will have enhanced your robot programming skills by building a range of simple to complex projects.
Table of Contents (19 chapters)
Title Page
Dedication
Packt Upsell
Contributors
Preface
Index

Making the LED blink


In order to make the LED blink, we'll need to install the code on the Raspberry Pi, and then run it!

 

 

Putting your code on the Raspberry Pi

If you wrote your code on your desktop and need to transfer it to your Raspberry Pi, there are a couple of ways to go about it: you can use rsync on an macOS X or Linux machine:

rsync ./blink-led.js 
[email protected]:~/<project folder>/

Replace <project folder> with the folder you want to transfer into (for example, the book folder would be hands-on-robotics-with-javascript/ch2/blink-led).

Note

For Windows, follow the guide for installing and using WinSCP at https://winscp.net/eng/docs/ui_commander.

Running your code

Once your code is on your Raspberry Pi, you'll want to switch to your SSH session and run the following, if you're using the source code from this book:

cd hands-on-robotics-with-javascript/ch2/blink-led

Otherwise, use cd to enter the folder where you stored your blink-led.js file on the Raspberry Pi. Then, run...