Entradas

Mostrando entradas de marzo, 2024

Traffic light algortihm

 int RED=5; // define the value for the red LED pin int YELLOW=11; // define the value for the yellow LED pin int GREEN=3; // define the value for the green LED pin void setup() {   pinMode(GREEN, OUTPUT); // declare the green pin as output     pinMode(YELLOW, OUTPUT); // declare the yellow pin as output   pinMode(RED, OUTPUT); // declare the red pin as output   } void loop() {    digitalWrite(RED, HIGH); // turn on the green LED  delay(2000); // wait for 2 seconds  digitalWrite(RED, LOW); // turn off the green LED  delay(500); // wait for half a second    digitalWrite(YELLOW, HIGH); // turn on the yellow LED  delay(2000); // wait for 2 seconds  digitalWrite(YELLOW, LOW); // turn off the yellow LED  delay(500); // wait for half a second  digitalWrite(GREEN, HIGH); // turn on the red LED  delay(3000); // wait for 2 seconds  digitalWrite(GREEN, LOW); // turn off the red LED  delay(500); // wait for half a second  }

Arduino C Simulator

https://wokwi.com/projects/new/arduino-uno

Third grade

Imagen
 

Arduino C Content for the quiz)

Imagen