Instructions

www.joy-it.net
Pascalstr. 8 47506 Neukirchen-Vluyn
When the key is pressed, the LED is on, otherwise it remains o. The
simple principle of this experiment is oen used in a variety of circuits
and electrical devices.
220 Ω
10 kΩ
int BASE = 2 ; // I/O Pin for the first LED
int NUM = 6; // Amount of LEDs
void setup() {
for (int i = BASE; i < (BASE + NUM); i ++) {
pinMode(i, OUTPUT); // Sets I/O Pins to output
}
}
void loop() {
for (int i = BASE; i < (BASE + NUM); i ++) {
digitalWrite(i, LOW); // Set I/O Pin to low
// turns on leds one by one
delay(200); // delay
}
for (int i = BASE; i < (BASE + NUM); i ++) {
digitalWrite(i, HIGH); // Sets I/O Pin to high
// turns off led one by one
delay(200); // delay
}
}