Have a look at the video version of this Instructable. If the embedded video does not appear on your mobile device, follow the alternative link. If you like this tutorial please follow me here in Instructables and subscribe to my YouTube channel.
Step 1: Getting Ready
For this tutorial you need the following hardware components:
- Raspberry Pi (any model or version)
- Male to female jumper wires (x2)
- microSD card with Raspian GNU/Linux distribution
- Power supply
Step 2: Wiring
One of the jumper wires should be connected to ground which is on pin 6 of Raspberry Pi. The other wire goes to pin 7. The resistor should be on the breadboard, between the second wire and the LED (as shown in the photos).
Step 3: Setting Up Development Environment
Make sure that Raspbian GNU/Linux distribution is running on your Raspberry Pi. Log in though SSH or just open a terminal application on the Pi itself. After that execute the following command to install Node.js, npm (Node Package Manager) and git:
sudo apt-get install -y nodejs npm git
Step 4: Installing the Example
Get the open source example and install its dependencies using npm:
git clone https://github.com/leon-anavi/rpi-nodejs-examples.git cd rpi-nodejs-examples npm install
Step 5: Blinking LED
Execute the following command with root permission and the LED will start blinking on every second:
sudo nodejs led/led.js
Step 6: How Does It Work?