For this mini project, things are simple and straight forward, simply tell the LED when to turn on and off, its a things that I could write the program on my own but I still decided to post it because my final idea has something to do with this sort of layout, and it does give me idea of how am I going to approach it in a better way.
code for this project:
int ledred=10;
int ledyellow=7;
int ledgreen=4;
void setup()
{
pinMode(ledred,OUTPUT);
pinMode(ledyellow,OUTPUT);
pinMode(ledgreen,OUTPUT);
}
void loop() {
digitalWrite(ledred,HIGH);
delay(1000);
digitalWrite(ledred,LOW);
digitalWrite(ledyellow,HIGH);
delay(200);
digitalWrite(ledyellow,LOW);
digitalWrite(ledgreen,HIGH);
delay(1000);
digitalWrite(ledgreen,LOW);
)
pinMode(ledyellow,OUTPUT);
pinMode(ledgreen,OUTPUT);
}
void loop() {
digitalWrite(ledred,HIGH);
delay(1000);
digitalWrite(ledred,LOW);
digitalWrite(ledyellow,HIGH);
delay(200);
digitalWrite(ledyellow,LOW);
digitalWrite(ledgreen,HIGH);
delay(1000);
digitalWrite(ledgreen,LOW);
)