Professional Documents
Culture Documents
runningLED(blinkRate);
} // end of loop()
Running LED controlled by a potentiometer
void runningLED(int rate)
{
for(int i = 0; i < NumLEDs; i++)
{
digitalWrite(LedPins[i], HIGH); // switch ON the LED
delay(rate);
digitalWrite(LedPins[i], LOW); // switch OFF the same LED
}
} // end of runningLED()
Exercises
1. Construct an Arduino program that controls six LEDs using the potentiometer such that ON,
OFF of these LEDs can be changed based on the running LEDs controlled by a potentiometer.
When the potentiometer is rotated in the clockwise direction the six LEDs turn ON series of
LEDs and when the potentiometer is rotated anti-clockwise the LEDs turn OFF series of LEDs.
Experiment 9