Ready to get started? make sure to follow these steps

In order to get started with the lessons, you need to prepare your computer so that it can interact with the Arduino board. You will need two main software components; the JavaScript run-time called Node.JS and the Arduino software along with the drivers. Node.JS will allow you to run your JavaScript programs on your computer. JavaScript will then send all the commands to the Arduino using the serial communications via the USB port. The Arduino software will allow you to prepare the Arduino board with the code necessary to accept the commands send by Node.JS in real-time.

Why JavaScript and not C?

JavaScript is quickly becoming a versatile language used in many different environments. Originally used in browsers to enhance the user experience, it has also been adopted for server side functions and lately in robotics with the availability of libraries such as serialcomm and Johnny-five. JavaScript is much easier to learn for kids when getting started. Kids will learn all basic constructs of a program, including variable assignments, flow control and function calling.

Let's get started

Install Node.JS v. 8.9.3

Download Node.JS from http://www.nodejs.org/en/download. Node.JS is the JavaScript run-time process that will execute your code and translate it to commands received by the Arduino board. Once the Arduino board receives the commands, it will send signals to the pins and components you have specified in your code. This will allow you to control LEDs, motors and also receive information from sensors.

Once the package is downloaded, double click on it from your downloads directory and follow the steps until the install is completed.

2. Verify your Node.JS Installation

Make sure Node.JS is installed successfully and it is running by checking the version number.

2.1. First, open a Terminal window. The command prompt window will allow you to execute commands to start Node.JS and to execute your JavaScript programs.

To find the Terminal window simply search for the "Terminal.app" on the search bar of Finder. Double click and it will open your Terminal window. You will use this window to send all your commands.

2.2 Check the version of node installed by typing:

node --version

Verify that your version starts with 0.10 or 4.

If you get an error message, Node.JS was not installed or failed it's installation. Try downloading it again and re-installing it.

2.3 Install Johnny-five. Johnny-five is the library necessary to send commands to the Arduino. Install it using the command below:

sudo npm install johnny-five

You will be prompted for your password. Make sure there were no error messages.

Arduino

Have you installed the Arduino software already?

You will not be using the Arduino IDE (Integrated Development Environment) to program the Arduino. However, you will need to flash your Arduino board (upload software to it) that will translate the JavaScript commands and install any associated drivers for it to function properly.