Go Down

Topic: Traffic light code (beginner level coding) (Read 38172 times) previous topic - next topic

kingjayjay14

void setup() {
  // initialize digital pin 13 as an output.
  pinMode(13, OUTPUT);
  pinMode(12, OUTPUT);
  pinMode(11, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(13, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(10000);                       // wait for ....
  digitalWrite(13, LOW);    // turn the LED off by making the voltage LOW
  delay(250);                       // wait for...

   digitalWrite(12, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(10000);                       // wait for .....
  digitalWrite(12, LOW);    // turn the LED off by making the voltage LOW
  delay(250);                       // wait for .....

   digitalWrite(11, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(10000);                       // wait for...
  digitalWrite(11, LOW);    // turn the LED off by making the voltage LOW
  delay(250);                       // wait for...
}

MarkoDerdic

Hi guys
I am a student and i dont understand Arduino. Can someone tell me is this program okey for traffic scoreboard?


int crvena = 7;
int zuta = 6;
int zelena = 5;
void setup()
{
  pinMode(crvena,OUTPUT);
  pinMode(zuta,OUTPUT);
  pinMode(zelena,OUTPUT);
}
void loop()
{
  digitalWrite(crvena,HIGH);
  delay(10000);
  digitalWrite(crvena,HIGH);
  digitalWrite(zuta,HIGH);
  delay(2000);
  digitalWrite(crvena,LOW);
  digitalWrite(zuta,LOW);
  digitalWrite(zelena,HIGH);
  delay(200000);
  digitalWrite(zelena,LOW);
  digitalWrite(zuta,HIGH);
  delay(1000);
}

mp_147

Hi guys,
Im new to arduino forum. Im going to create a density based traffic signal control system. I used 12 IR sensor. 3 sensor per road is converted into analog input using R-2R network. Red and green signal leds are multiplexed using not gate to reduce arduino pins. Lcd display is connected to display timings of roads. So can anyone help me for program...

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy