První pokusy – running LED light

V „kouzelném“, cca 20 let neotevřeném šuplíku, jsem našel nějaké LEDky a další součástky, v jediném šikovném obchodě v Č. Budějovicích jsem koupil nepájivé pole a už mi nic nebránilo v dalším zkoumání Arduina.

Po povinném rozblikání jedné LEDky na třináctém pinu pomocí programu Blink jsem tento upravil pro osm LEDek a výsledek je zde:

int led1 = 13;
int led2 = 12;
int led3 = 11;
int led4 = 10;
int led5 = 9;
int led6 = 8;
int led7 = 7;
int led8 = 6;
int pause = 100;

// the setup routine runs once when you press reset:
void setup() { // initialize the digital pins as an outputs.
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(led3, OUTPUT);
pinMode(led4, OUTPUT);
pinMode(led5, OUTPUT);
pinMode(led6, OUTPUT);
pinMode(led7, OUTPUT);
pinMode(led8, OUTPUT); }
// the loop routine runs over and over again forever:
void loop() {
digitalWrite(led1, HIGH); // turn the LED on
digitalWrite(led2, LOW); // turn the LED off
delay(pause); // wait for a setup time
digitalWrite(led2, HIGH); // turn the LED on
digitalWrite(led1, LOW); // turn the LED off
delay(pause); // wait for a setup time
digitalWrite(led3, HIGH); // turn the LED on
digitalWrite(led2, LOW); // turn the LED off
delay(pause); // wait for a setup time
digitalWrite(led4, HIGH); // turn the LED on
digitalWrite(led3, LOW); // turn the LED off
delay(pause); // wait for a setup time
digitalWrite(led5, HIGH); // turn the LED on
digitalWrite(led4, LOW); // turn the LED off
delay(pause); // wait for a setup time
digitalWrite(led6, HIGH); // turn the LED on
digitalWrite(led5, LOW); // turn the LED off
delay(pause); // wait for a setup time
digitalWrite(led7, HIGH); // turn the LED on
digitalWrite(led6, LOW); // turn the LED off
delay(pause); // wait for a setup time
digitalWrite(led8, HIGH); // turn the LED on
digitalWrite(led7, LOW); // turn the LED off
delay(pause); // wait for a setup time
digitalWrite(led7, HIGH); // turn the LED on
digitalWrite(led8, LOW); // turn the LED off
delay(pause); // wait for a setup time
digitalWrite(led6, HIGH); // turn the LED on
digitalWrite(led7, LOW); // turn the LED off
delay(pause); // wait for a setup time
digitalWrite(led5, HIGH); // turn the LED on
digitalWrite(led6, LOW); // turn the LED off
delay(pause); // wait for a setup time
digitalWrite(led4, HIGH); // turn the LED on
digitalWrite(led5, LOW); // turn the LED off
delay(pause); // wait for a setup time
digitalWrite(led3, HIGH); // turn the LED on
digitalWrite(led4, LOW); // turn the LED off
delay(pause); // wait for a setup time
digitalWrite(led2, HIGH); // turn the LED on
digitalWrite(led3, LOW); // turn the LED off
delay(pause); // wait for a setup time
digitalWrite(led1, HIGH); // turn the LED on
digitalWrite(led2, LOW); // turn the LED off
delay(pause); // wait for a setup time
digitalWrite(led1, HIGH); // turn the LED on
delay(pause); // wait for a setup time
digitalWrite(led2, HIGH); // turn the LED on
delay(pause); // wait for a setup time
digitalWrite(led3, HIGH); // turn the LED on
delay(pause); // wait for a setup time
digitalWrite(led4, HIGH); // turn the LED on
delay(pause); // wait for a setup time
digitalWrite(led5, HIGH); // turn the LED on
delay(pause); // wait for a setup time
digitalWrite(led6, HIGH); // turn the LED on
delay(pause); // wait for a setup time
digitalWrite(led7, HIGH); // turn the LED on
delay(pause); // wait for a setup time
digitalWrite(led8, HIGH); // turn the LED on
delay(pause); // wait for a setup time
digitalWrite(led8, LOW); // turn the LED off
delay(pause); // wait for a setup time
digitalWrite(led7, LOW); // turn the LED off
delay(pause); // wait for a setup time
digitalWrite(led6, LOW); // turn the LED off
delay(pause); // wait for a setup time
digitalWrite(led5, LOW); // turn the LED off
delay(pause); // wait for a setup time
digitalWrite(led4, LOW); // turn the LED off
delay(pause); // wait for a setup time
digitalWrite(led3, LOW); // turn the LED off
delay(pause); // wait for a setup time
digitalWrite(led2, LOW); // turn the LED off
delay(pause); // wait for a setup time
digitalWrite(led1, LOW); // turn the LED off
delay(pause); // wait for a setup }