Electronic Circuits and Projects Forum



traffic light

« First 12
  1. #11
    alec_t alec_t is online now
    A delay routine can be used for whatever delaying purpose you like, not just LED control, and can provide fixed or variable delays. You could instead configure an in-built timer in the micro to provide a delay.
    0
    My circuit designs should be regarded as experimental. Although they work in simulation, their component values may need altering or additional components may occasionally be necessary when the circuit is built. Due safety precautions should be taken with any circuit involving mains voltage or electrostatic-sensitive components.
    Alec's First Law:-
    Every problem has a solution (given the right information and resources).

  2. Thread Starter #12
    kiosk kiosk is offline
    I want to make the micro send data only when the INPUT is HIGH for say, 30 seconds and after that it will send data to the traffic light that it will add time to the GREEN light because there is a long line of cars blocking the sensor. I want to know to do this. I just know how to set the time of the traffic light using the delay function. I used the sketch as follows;

    int green1 = 13;
    int yellow1 = 12;
    int red1 = 11;
    int green = 7;
    int yellow = 6;
    int red = 5;

    void setup(){

    pinMode(green1, OUTPUT);
    pinMode(yellow1, OUTPUT);
    pinMode(red1, OUTPUT);
    pinMode(green, OUTPUT);
    pinMode(yellow, OUTPUT);
    pinMode(red, OUTPUT);


    }

    void loop(){
    // first traffic light
    digitalWrite(green1, HIGH);
    digitalWrite(red, HIGH);
    delay(10000);
    digitalWrite(green1, LOW);
    digitalWrite(red, HIGH);
    delay(500);
    digitalWrite(green1, HIGH);
    digitalWrite(red, HIGH);
    delay(500);
    digitalWrite(green1, LOW);
    digitalWrite(red, HIGH);
    delay(500);
    digitalWrite(green1, HIGH);
    digitalWrite(red, HIGH);
    delay(500);
    digitalWrite(green1, LOW);
    digitalWrite(red, HIGH);
    delay(500);
    digitalWrite(yellow1, HIGH);
    digitalWrite(red, HIGH);
    delay(2000);
    digitalWrite(yellow1, LOW);
    digitalWrite(red, LOW);

    // second traffic light
    digitalWrite(green, HIGH);
    digitalWrite(red1, HIGH);
    delay(10000);
    digitalWrite(green, LOW);
    digitalWrite(red1, HIGH);
    delay(500);
    digitalWrite(green, HIGH);
    digitalWrite(red1, HIGH);
    delay(500);
    digitalWrite(green, LOW);
    digitalWrite(red1, HIGH);
    delay(500);
    digitalWrite(green, HIGH);
    digitalWrite(red1, HIGH);
    delay(500);
    digitalWrite(green, LOW);
    digitalWrite(red1, HIGH);
    delay(500);
    digitalWrite(yellow, HIGH);
    digitalWrite(red1, HIGH);
    delay(2000);
    digitalWrite(yellow, LOW);
    digitalWrite(red1, LOW);

    }
    0

  3. #13
    alec_t alec_t is online now
    I'm not familiar with the Arduino, but for a start won't you need code to setup the INPUT function? Then you will need some sort of IF ....THEN routine to test the INPUT and execute a delay(xxxx) before switching green off if there is a traffic queue detected.
    0
    My circuit designs should be regarded as experimental. Although they work in simulation, their component values may need altering or additional components may occasionally be necessary when the circuit is built. Due safety precautions should be taken with any circuit involving mains voltage or electrostatic-sensitive components.
    Alec's First Law:-
    Every problem has a solution (given the right information and resources).

« First 12
Tags
Similar Threads
Thread Starter Forum Replies Last Post
Traffic Light circuit building problems oxygen454 General Electronics Chat 16 26th February 2010, 07:31 AM
Building a traffic light pattern and Im stuck (triac help!) oxygen454 Electronic Projects Design/Ideas/Reviews 10 20th December 2003, 03:30 AM
TRAFFIC LIGHT SYSTEM SCHEMATIC NEEDED koolhudson Electronic Projects Design/Ideas/Reviews 1 22nd November 2003, 01:05 PM
Traffic Light system (Urgent help needed) koolhudson Electronic Projects Design/Ideas/Reviews 6 21st November 2003, 03:37 AM
Actual Size Traffic Light Controller WITH SWITCHPACK mrdexterous Electronic Projects Design/Ideas/Reviews 2 10th June 2003, 05:29 AM
Electronic Circuits  |  Learning Electronics

Join our community with over 100,000 Members! It's free, easy and when you're logged in you have many more features! Click to register.
Page Time: 0.05077 seconds      Memory: 7,272 KB      Queries: 17      Templates: 0