Assignment 6.1

posted Aug 15, 2010, 5:01 PM by Unknown user
int potPin = 2;
int val = 0;

void setup()
{
}

void loop()
{
  for (int led = 13; led >=5; led--)
  {
    val = analogRead(potPin); 
    pinMode(led, OUTPUT);
    digitalWrite(led, HIGH);
    delay(val);
    digitalWrite(led, LOW);
    delay(val);
  }
  for (int led = 5; led <=13; led++)
  {
    val = analogRead(potPin);
    pinMode(led, OUTPUT);
    digitalWrite(led, HIGH);
    delay(val);
    digitalWrite(led, LOW);
    delay(val);
  }
}

Comments