matteoPrada
Published © Apache-2.0

LEGO Traffic Light

It's a simple LEGO traffic light.

BeginnerShowcase (no instructions)2,777
LEGO Traffic Light

Things used in this project

Story

Read more

Code

CODE FOR LEGO

C/C++
int ledG = 13;
int ledV = 12;
int ledR = 11;

void setup() {
  // put your setup code here, to run once:
pinMode(ledR, OUTPUT);
pinMode(ledV, OUTPUT);
pinMode(ledG, OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
digitalWrite(ledV, HIGH);
delay(9000);
digitalWrite(ledV, LOW);
delay(10);

digitalWrite(ledR, HIGH);
delay(6000);
digitalWrite(ledR, LOW);
delay(10);

digitalWrite(ledG, HIGH);
delay(4000);
digitalWrite(ledG, LOW);
delay(10);
}

Credits

matteoPrada

matteoPrada

2 projects • 1 follower

Comments