Thursday, September 14, 2023

Lesson 6: Multiple LEDS

 Try adding multiple LEDS, blinking in order:




Write code that turns multiple LEDs on and off- use the Copy and Paste functions to save time typing!

void setup() {
// initialize digital pin LED_BUILTIN as an output.
pinMode(7, OUTPUT);

pinMode(9, OUTPUT);


}

// the loop function runs over and over again forever
void loop() {

digitalWrite(7, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(7, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second

digitalWrite(9, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(9, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}

No comments:

Post a Comment