Video

Homework 02 – LED and Sound with Potentiometer – Casey Henrichs

29 Oct

int red = 3; //setting red led variable
int blue = 5; //setting blue led variable
int green = 6; //setting green led variable
int pot = 0;

void setup() {
pinMode(red,OUTPUT);
pinMode(green,OUTPUT);
pinMode(blue,OUTPUT);
}

void loop () {
pot = (analogRead(A0));
digitalWrite(red, HIGH);
delay(pot);
digitalWrite(red,LOW);
delay(pot);
digitalWrite(red, HIGH);
delay(pot);
digitalWrite(red,LOW);
delay(pot);
digitalWrite(green, HIGH);
delay(pot);
digitalWrite(green,LOW);
delay(pot);
digitalWrite(blue, HIGH);
delay(pot);
digitalWrite(blue,LOW);
delay(pot);
digitalWrite(blue, HIGH);
delay(pot);
digitalWrite(blue,LOW);
delay(pot);
digitalWrite(green, HIGH);
delay(pot);
digitalWrite(green,LOW);
}

Advertisements

One Response to “Homework 02 – LED and Sound with Potentiometer – Casey Henrichs”

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

    I can hear it!

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