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

Setting up your password and hardware interfaces


Now that we have our Raspberry Pi connected to the Wi-Fi and we're SSHed in, we need to make a few changes before we install Node.js and get started with our coding.

First things first – change your password!

When you log in, your Raspberry Pi will warn you that having SSH enabled with the default username and password isn't very secure, and it's absolutely right! The first step is to change our password.

 

In order to do so, in your SSH window, type in passwd and hit Enter. You'll be prompted for your current password (raspberry) and a new password. Type in whatever you like (just don't forget it)! You'll be asked to confirm it, and voila! The new password is set, as shown in the following screenshot. Your Raspberry Pi will be much more secure:

Changing your Pi password

Updating the Raspberry Pi

Next, you'll make sure that the Raspberry Pi is updated and ready to go by running the following command:

sudo apt-get update && sudo apt-get upgrade

This will take a while, but it's worth it to make sure everything is properly updated.

Turning on the hardware interfaces

Next, we'll set up the Raspberry Pi so that our hardware code can run. Run the following command:

sudo raspi-config

You'll be greeted with a graphical menu with lots of different options, as shown in the following screenshot:

The raspi-config menu

You'll want to use the arrow keys to select Interfacing Options, and then select I2C and Yes to turn it on. Repeat for SPI, then use Tab to close the menu. When it prompts you to reboot, say Yes, then SSH back in, because you're ready to install Node.js, Johnny-Five, and Raspi-IO!