Go Down

Topic: LED dilema (Read 1 time) previous topic - next topic


Yea, my mistake, I get the two confused all the time, sorry.
My GitHub:


This is how i need the LEDs to glow

LANE1                            LANE2                            LANE3                             LANE4               time
green1                             red2                                 red3                                  red 4                   0
yellow1(2 sec)                    yellow2(2 sec)                    red 3                                 red  4                  30 sec
red1                                 green2                              red  3                                red  4                  32 sec
red1                               yellow2                              yellow 3                              red   4                 62 sec
red1                                 red 2                                 green 3                              red  4                  64 sec
red1                                 red 2                                 yellow  3                             yellow 4                94 sec
red1                                 red  2                                 red  3                                 green 4               96 sec

and the loop continues      


LANE1                            LANE2                            LANE3                             LANE4               time
green1                             red2                                 red3                                  red 4                   0
yellow1(2 sec)                    yellow2(2 sec)                    red 3                                 red  4                  30 sec
red1                                 green2                              red  3                                red  4                  32 sec
red1                               yellow2                              yellow 3                              red   4                 62 sec
red1                                 red 2                                 green 3                              red  4                  64 sec
red1                                 red 2                                 yellow  3                             yellow 4                94 sec
red1                                 red  2                                 red  3                                 green 4               96 sec

Not going to lie, that is kinda confusing.
So you want a 30 sec delay between Grn and YEl, 2sec between Yel and Red and 30sec again between Red and Grn.
is that right?
My GitHub:


no I want the green light to glow for 30 seconds. Then I want the yellow to glow for 2 seconds (Warning for a change from green to red).Then i need red to glow for 30 seconds.Then i want yellow to glow for 2 seconds (Warning for change from red to green)

What i have shown as a table is how a traffic light system at a 4 way junction will work.


Start simple, get one set (lane) to work properly, then invert the grn and red for the perpendicular side. You may need to adjust the delays.
My GitHub:


A normal intersection goes grn - yel, yel - red, red - grn, why add the extra yel?
My GitHub:


K thanks

will you suggest an emulator for arduino.


The only emulator I know of is the one for the IPhone, and I dont know for sure if that will work like you want it to, I never tried it.

Also, Im at work right now and we dont allow WIFI, so I couldn't get it on my phone now if I wanted to.

You should look for a PC or MAC version, there has to be one.
My GitHub:


want windows version but the one i downloaded is not working


Firstly simple: use an array to indicate time and on/off status of led. Let's pick a number and its lowest 3 bits represent the 3 leds (RGY <->0bxyz), with '1' means on and '0' means off.

So your sequence is this:

0, 0b010, 0b100, 0b100, 0b100, //at time 0, lane 1's green is on, and lane 2..4's red is on
30, 0b001, 0b001, 0b100, 0b100, //at time 30, lane 1..2's yellow is on and lane 3..4's red is on
32, 0b100, 0b010, 0b100, 0b100, //at time 32, lane1's red is on, lane2's green is on, and lane3..4's red is on.

All you need to do in your code is to detect if the time has come to change the leds and then change them.

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!

via Egeo 16
Torino, 10131