Learn to Deploy and Debug an Arduino Wiring sketch on Raspberry Pi 2 and 3 or Minnowboard Max to blink an LED!
Follow the Arduino Wiring Project Guide to create a new wiring project!
This code is included in the default template of an Arduino Wiring project, and is included here (with additional comments) for reference.
LEDs are diodes which will emit light when powered. They are polarized - meaning they work only when plugged in correctly. Typically, the longer leg is positive, while the shorter leg is negative. Additionally, you should never connect an LED directly to power and ground without a resistor in the circuit. Without a resistor to slow the flow of current, you’ll burn out the LED (at best) and could do damage to your other hardware! For an LED, it is fairly typical to use a 220 or 330 ohm resistor, but anything in the range of 220 - 1000 (1Kohm) ohms is acceptable.
Notice that we’re using
GPIO5 in the sketch above. This is a special value that maps to a specific pin on a Raspberry Pi 2 and 3. If we connect the positive leg of the LED to the same pin, this sketch will provide power to the circuit when we toggle that pin HIGH, turning the LED on. The fritzing diagram below shows this connection. If you wish to use another GPIO pin, you’ll need to change both the
GPIOx value (where
x is the GPIO pin number) in the sketch, as well as the physical wiring of the LED.
Here is a pinout diagram of the Raspberry Pi 2:
Press F5 to build and deploy your project.
Refer to the Arduino Wiring Project Guide for more instructions on how to deploy your app!
You should see the LED blinking on and off, spending about a half second in each state. If it isn’t blinking, try reversing the LED leads.
Refer to the Arduino Wiring Porting Guide for common issues and concerns when working with Arduino Wiring sketches.
Your session has expired. Please sign-in again to continue. Unfortunately any unsaved changes will be lost.