Pages: 1 [2]   Go Down
Author Topic: LED dilema  (Read 809 times)
0 Members and 1 Guest are viewing this topic.
Queens, New York
Offline Offline
Faraday Member
**
Karma: 84
Posts: 3417
"Of all the things I've ever lost, I miss my mind the most" -Ozzy Osbourne
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yea, my mistake, I get the two confused all the time, sorry.
Logged

Created Libraries:
NPV2 (NewPasswordV2),  TFT_Extension, OneWireKeypad, SerialServo.
Will provide libraries if asked in PM or forum.

Offline Offline
Jr. Member
**
Karma: 0
Posts: 76
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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      
Logged

Queens, New York
Offline Offline
Faraday Member
**
Karma: 84
Posts: 3417
"Of all the things I've ever lost, I miss my mind the most" -Ozzy Osbourne
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
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?
Logged

Created Libraries:
NPV2 (NewPasswordV2),  TFT_Extension, OneWireKeypad, SerialServo.
Will provide libraries if asked in PM or forum.

Offline Offline
Jr. Member
**
Karma: 0
Posts: 76
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Queens, New York
Offline Offline
Faraday Member
**
Karma: 84
Posts: 3417
"Of all the things I've ever lost, I miss my mind the most" -Ozzy Osbourne
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Created Libraries:
NPV2 (NewPasswordV2),  TFT_Extension, OneWireKeypad, SerialServo.
Will provide libraries if asked in PM or forum.

Queens, New York
Offline Offline
Faraday Member
**
Karma: 84
Posts: 3417
"Of all the things I've ever lost, I miss my mind the most" -Ozzy Osbourne
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

A normal intersection goes grn - yel, yel - red, red - grn, why add the extra yel?
Logged

Created Libraries:
NPV2 (NewPasswordV2),  TFT_Extension, OneWireKeypad, SerialServo.
Will provide libraries if asked in PM or forum.

Offline Offline
Jr. Member
**
Karma: 0
Posts: 76
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

K thanks

will you suggest an emulator for arduino.
Logged

Queens, New York
Offline Offline
Faraday Member
**
Karma: 84
Posts: 3417
"Of all the things I've ever lost, I miss my mind the most" -Ozzy Osbourne
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Created Libraries:
NPV2 (NewPasswordV2),  TFT_Extension, OneWireKeypad, SerialServo.
Will provide libraries if asked in PM or forum.

Offline Offline
Jr. Member
**
Karma: 0
Posts: 76
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

want windows version but the one i downloaded is not working
Logged

Offline Offline
Edison Member
*
Karma: 116
Posts: 2205
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

Logged

Pages: 1 [2]   Go Up
Jump to: