Advertisement
belrey10

Day 3: The Illuminated Path

Nov 2nd, 2024 (edited)
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const int ledPin1 = 8;      // the number of the first LED pin
  2.       const int ledPin2 = 9;      // the number of the second LED pin
  3.       const int ledPin3 = 10;     // the number of the third LED pin
  4.  
  5.       void setup() {
  6.         pinMode(ledPin1, OUTPUT);  // initialize the first LED pin as an output
  7.         pinMode(ledPin2, OUTPUT);  // initialize the second LED pin as an output
  8.         pinMode(ledPin3, OUTPUT);  // initialize the third LED pin as an output
  9.       }
  10.  
  11.       void loop() {
  12.         digitalWrite(ledPin1, HIGH);  // turn the first LED on
  13.         delay(500);                   // wait for half a second
  14.         digitalWrite(ledPin1, LOW);   // turn the first LED off
  15.  
  16.         digitalWrite(ledPin2, HIGH);  // turn the second LED on
  17.         delay(500);                   // wait for half a second
  18.         digitalWrite(ledPin2, LOW);   // turn the second LED off
  19.  
  20.         digitalWrite(ledPin3, HIGH);  // turn the third LED on
  21.         delay(500);                   // wait for half a second
  22.         digitalWrite(ledPin3, LOW);   // turn the third LED off
  23.       }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement