Lab 1

Submitted by zwasson on Tue, 02/05/2013 - 02:04


The purpose of this lab was to get the Arduino environment set up and to use an example program for the Arduino to blink an LED. The code was then modified to blink three LEDs simultaneously every 500ms.


  • Arduino Uno
  • Red LED
  • Green LED
  • Blue LED
  • 3 220ohm resistors


  Turns on three LEDs for 500ms, then off for 500ms, repeatedly.
  This example code is in the public domain.
// LED definitions with associated pins
int red_led = 13;
int green_led = 12;
int blue_led = 11;
int state = LOW;
// the setup routine runs once when you press reset:
void setup() {                
  // initialize the digital pins as outputs.
  pinMode(red_led, OUTPUT);  
  pinMode(green_led, OUTPUT); 
  pinMode(blue_led, OUTPUT); 
// the loop routine runs over and over again forever:
void loop() {
  digitalWrite(red_led, state);   // toggle the LEDs state
  digitalWrite(green_led, state);
  digitalWrite(blue_led, state);
  state = !state;
  delay(500);               // wait for 500ms
Your rating: None
Drupal theme by Kiwi Themes.