Homework 02-RGB LED Blink with Pentiometer-Elena Brown

31 Oct

IMG_2592IMG_2591

int red = 3; //setting red led variable

int blue = 5; //setting blue led variable

int green = 6; //setting green led variable

int pot = 0; //setting the potentiomete

void setup() {

  pinMode(red, OUTPUT);

  pinMode(blue, OUTPUT);

  pinMode(green, OUTPUT);

}

void loop () {

  pot = analogRead(A0); //Analog output set to A0

  digitalWrite(red, HIGH); //turns red light on

  delay(pot); //keeps red light on for a the amount of time established by the potentiometer

  digitalWrite(red, LOW); //turns red light off

delay(pot); //keeps red light off for a the amount of time established by the potentiometer

  digitalWrite(blue, HIGH); //turns red light on

  delay(pot); //keeps red light on for a the amount of time established by the potentiometer

  digitalWrite(blue, LOW); //turns red light off

  delay(pot);//keeps red light off for a the amount of time established by the potentiometer

  digitalWrite(green, HIGH); //turns red light on

  delay(pot);//keeps red light on for a the amount of time established by the potentiometer

  digitalWrite(green, LOW); //turns red light off

  delay(pot);//keeps red light off for a the amount of time established by the potentiometer

}

Advertisements

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