File Downloads

Semester B Assessments

int potpin = A0;
int var = 0;
int delaytime = 0;

void setup()
{
Serial.begin(9600);

for (int ledpin = 2; ledpin <= 9; ledpin++)
   {pinMode(ledpin, OUTPUT);}

pinMode(potpin,INPUT);
}

void loop()
{
   var = analogRead(potpin);
   delaytime = map(var,0,1023,100,1000);
   for (int ledpin=2;ledpin <= 9; ledpin++)
  
  {    
      digitalWrite(ledpin, HIGH);
      delay(delaytime);
      digitalWrite(ledpin+1, HIGH);
      digitalWrite(ledpin-1, LOW);
      digitalWrite(9, LOW);

  } 
}

 

 

Inventor Files