

You may have noticed that the code refers to an LED on pin #13. Uses the express module to listen for HTTP requests on the port (in this case 8000).Modes are mapped via a switch statement to functions on the led.Defines a function using the express module to process HTTP GET requests in the format of /led/mode (where mode can be: ).Defines a function using the johnny-five modules board object for processing a ready event from the Arduino board.References required modules and sets variables.Create a file called index.js using your favorite text editor.Type: npm install express –-save (again, two dashes).Type: npm install johnny-five -save (two dashes before ‘save’).Just hit enter at all the prompts to accept the defaults.NodeJS and npm installed on the host (it may already be installed).The Arduino IDE installed on the host computer ( download it here).Windows users may need to look at tools like cygwin. They should run on most Linux boxes – including the Raspberry Pi. The author of this tutorial assumes no risk. See the References section at the end of this tutorial. *If you do plan to run an Arduino from a Raspberry Pi, check the power requirements before you cause a meltdown. One way to control it from a host is by using a special NodeJS module called johnny-five. The host can be a PC, a Mac or even a Raspberry Pi*. That will allow you to control the board via a serial connection from a host. But you can upload a special “sketch” (file) called Firmata. Internal logic or input wired to the board controls the output. To program it you write code in an IDE and then upload the code to the board. You can control things wired to it like LEDs and motors. The Arduino Uno is a popular microcontroller board for hobbyists.
ARDUINO USB CABLE FOR MAC HOW TO
In this tutorial I’m going to show you how to drive an Arduino Uno using NodeJS.
