arduino

mail@pastecode.io avatar
unknown
c_cpp
a month ago
1.3 kB
12
Indexable
Never
#define RED_PIN 1
#define YELLOW_PIN 5
#define GREEN_PIN 3
void setup(){
  pinMode(RED_PIN, OUTPUT);
  pinMode(YELLOW_PIN, OUTPUT);
  pinMode(GREEN_PIN, OUTPUT);
}
void loop(){
  digitalWrite(GREEN_PIN, HIGH);
  digitalWrite(YELLOW_PIN, LOW);
  digitalWrite(RED_PIN, LOW);
  delay(1000);
  digitalWrite(GREEN_PIN, LOW);
  digitalWrite(YELLOW_PIN, HIGH);
  digitalWrite(RED_PIN, LOW);
  delay(1000);
  digitalWrite(GREEN_PIN, LOW);
  digitalWrite(YELLOW_PIN, LOW);
  digitalWrite(RED_PIN, HIGH);
  delay(1000);
  digitalWrite(GREEN_PIN, LOW);
  digitalWrite(YELLOW_PIN, HIGH);
  digitalWrite(RED_PIN, LOW);
  delay(1000);
}
#define RED2_PIN 9
#define YELLOW2_PIN 8
#define GREEN2_PIN 7
void setup(){
  pinMode(RED2_PIN, OUTPUT);
  pinMode(YELLOW2_PIN, OUTPUT);
  pinMode(GREEN2_PIN, OUTPUT);
}
void loop(){
  digitalWrite(GREEN2_PIN, HIGH);
  digitalWrite(YELLOW2_PIN, LOW);
  digitalWrite(RED2_PIN, LOW);
  delay(3000);
  digitalWrite(GREEN2_PIN, LOW);
  digitalWrite(YELLOW2_PIN, HIGH);
  digitalWrite(RED2_PIN, LOW);
  delay(1000);
  digitalWrite(GREEN2_PIN, LOW);
  digitalWrite(YELLOW2_PIN, LOW);
  digitalWrite(RED2_PIN, HIGH);
  delay(3000);
  digitalWrite(GREEN2_PIN, LOW);
  digitalWrite(YELLOW2_PIN, HIGH);
  digitalWrite(RED2_PIN, LOW);
  delay(2000);
}
Leave a Comment