Homework 02 -RGB LED – Tyler Cook

29 Oct

20131028_174122 20131028_174118

This code makes the lights turn on and turn off in a line.

int green2 = 3;     //defining that green2 is pin 3
int blue = 5;    //defining that blue is pin 5
int green = 6;   //defining that green is pin 6
int red = 10;    //defining that red is pin 10
void setup() {
  pinMode(red, OUTPUT);
  pinMode(blue, OUTPUT);
  pinMode(green, OUTPUT);
  pinMode(green2, OUTPUT);
}
                                  // loop that runs over and over
void loop() {
  digitalWrite(green2, HIGH);     // turn green2 on
  delay(200);                     // delay for 200 ms
  digitalWrite(red, HIGH);        // turn red on
  delay(200);
  digitalWrite(blue, HIGH);       // turn blue on
  delay(200);
  digitalWrite(green, HIGH);      // turn green on
  delay(200);
  digitalWrite(green, LOW);       // turn green off
  delay(200);
  digitalWrite(blue, LOW);        // turn blue off
  delay(200);
  digitalWrite(red, LOW);         // turn red off
  delay(200);
  digitalWrite(green2, LOW);      // turn green2 off
  delay(200);
  }
Advertisements

One Response to “Homework 02 -RGB LED – Tyler Cook”

  1. justinberken October 29, 2013 at 10:45 pm #

    Glad you were able to get the RGB bulb working as well.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s