SparkFun Inventor's Kit for MicroView

Contributors: Joel_E_B
Favorited Favorite 7

Experiment 1: Blinking an LED

LEDs (light-emitting diodes) are small, powerful lights that are used in many different applications. To start off the MicroView course, we will work on blinking an LED. That's right -- it's as simple as turning a light on and off. It might not seem like much, but establishing this important baseline will give you a solid foundation as we work toward more complex experiments. Blink is the "Hello World" of hardware.

Parts Needed

You will need the following parts:

  • 1x LED
  • 1x 330Ω Resistor (Orange, Orange, Brown, Gold)

Breadboard Setup

Pay close attention to the polarity of the LED.

alt text

Hook up your circuit as pictured below:

Circuit 1

MicroView Arduino Code

Upload the following code to your MicroView:

int LED = A3;               // declare LED as pin A3 of MicroView

void setup()
    pinMode(LED, OUTPUT);   // set LED pin as OUTPUT

void loop()
    digitalWrite(LED, HIGH);    // set LED pin HIGH voltage, LED will be on
    delay(1000);                // delay 1000 ms 
    digitalWrite(LED, LOW);     // set LED pin LOW voltage, LED will be off
    delay(1000);                // delay 1000 ms

What You Should See

You should see your LED blink on and off. If it isn't, make sure you have assembled the circuit correctly and verified and uploaded the code to your MicroView or see the troubleshooting tips below.

Code to Note

Before you can use one of the MicroView's pins, you need to tell the MicroView whether it is an INPUT or OUTPUT. We use a built-in "function" called pinMode() to do this.

pinMode(A3, OUTPUT);

When you're using a pin as an OUTPUT, you can command it to be HIGH (output 5 volts), or LOW (output 0 volts).

digitalWrite(A3, HIGH);

Arduino programs run in a loop. When the MicroView sees the delay() command, it will pause the loop for the amount of time (in milliseconds). For example delay(1000) will stop the loop for one second as there are 1000 ms in one second.



LED Not Lighting Up?

LEDs will only work in one direction. Try taking it out and turning it around 180 degrees (no need to worry, installing it backward does no permanent harm).

Still No Success?

A broken circuit is no fun, send us an e-mail and we will get back to you as soon as we can: