thanks man you really are a life saver I am going to have an exam in my embedded class at 8:30 and watch this video at 7:00 I've got a lot from this. Now my exam will be well done!
I remember doing this in primary school in 1985 on a C64 computer with some external device attached.I had to add up the binary values to have the lights switched on/off. I had it how you've got with 2 lights immediately swapping but the teacher got me to modify it so both lights were red before either set proceeded to green. Loved it - just wish I knew what that gadget was called?
nice video. for the dual traffic light as done so far, a simple wiring G1 with R2 ; O1 with O2 ; R1 with G2. the ports can still handle the current I guess.
Nice. Yeh, you can easily drive quite a few LEDs from a basic Arduino. Check out our ancient LED cube project: ruclips.net/video/tqWAC4hu7nk/видео.html
I followed your video & your written version. The Traffic Lights worked, until I installed the button & modified the sketch. Getting an Error Message "Error compiling for board Arduino Nano". I'm using a Arduino Nano. Any thoughts? Please
Question, can the same logic work for an station indicator e.g Indicator light change to Red, green or yellow based on a on a DB field, my db is MSSQL, i want to do this project and looking for some inspirations
I just bought a real traffic light. As in a full size real stoplight. Could code like this be used to control the lights so that it doea more than just display all the lights on all the time?
In theory, yes, but it depends on how your traffic light is wired up. If it designed to show them all at once, it could be that there's only a single light source in there, with three different colored lenses. Alternatively, you could wire up your own LED light sources behind each section?
@@MakeUseOf I'll be picking it up in a few hours. I'll dig in and explore it more soon. I'm guessing it has 3 different light sources and that someone did a bit of rewiring so that all 3 lights stay on constantly.
Wouldn't that just be another set of each lights? Just a case of adding more LEDs to the same pins, you wouldn't need to adjust the coding, unless you wanted specific code for turning left/right stages?
You said 10 kohm resistor at 6:07 but the color band in the picture diagram show only 1 kohm resistor (brown,black,red)... 10 k ohm resistor should be brown, black, yellow
You can make a counter feom 1 to 4, one up every 5 seconds for example. Then say that green is on when counter is 1, yellow is on when counter is 2 or 4 and red is on when counter is 3.
I would love to create something along those line for a model railway signal triggered by an IR obstacle sensor but I have not got a clue how to modify the code.
I know this is probably unrelated, but I've been trying to find a tutorial for a Verilog code that does this exact same thing, simulate a single traffic light using the LEDs on the FPGA board. Do you have any idea where I can find such a tutorial ?
Sure, but you'd need a relay if the lightbulbs are running on AC power, and I wouldn't suggest playing with AC power if this is your first Arduino project!
I have the Elegoo Uno R3 starter it as well. However, I had some issues with the code. For some strange reason, the lights were not operating as described in the code. I ended up having to put the OPPOSITE values for on and off. example: void changeLights(){ // green off, yellow on for 3 seconds digitalWrite(yellow, LOW); digitalWrite(red, HIGH); digitalWrite(green, HIGH); delay(3000); If I did not enter the values of each pin, the LED would stay on if I wanted it off. I had hand-typed the code as you have it on your website, copied/pasted as well. but only got the desired results when I changed the values as given.Also, this always starts with yellow every time. I know, right? Strange, but true.
thanks man you really are a life saver I am going to have an exam in my embedded class at 8:30 and watch this video at 7:00 I've got a lot from this. Now my exam will be well done!
I remember doing this in primary school in 1985 on a C64 computer with some external device attached.I had to add up the binary values to have the lights switched on/off. I had it how you've got with 2 lights immediately swapping but the teacher got me to modify it so both lights were red before either set proceeded to green. Loved it - just wish I knew what that gadget was called?
a microcontroller SDK
I’m sorry but you didn’t #ratio
Where u belong to means which country 😅
i made it myself and it worked :)
nice video. for the dual traffic light as done so far, a simple wiring G1 with R2 ; O1 with O2 ; R1 with G2. the ports can still handle the current I guess.
Nice. Yeh, you can easily drive quite a few LEDs from a basic Arduino. Check out our ancient LED cube project: ruclips.net/video/tqWAC4hu7nk/видео.html
how can i add another 4 led to make traffic signal?
8:10 when i compile changeLights()" on line 22 gives an error 'expected ')' before ';' token'. does anyone knows how to fix this?
Have you ended all lines with ; ?
MakeUseOf I found out what i was doing wrong, after an earlier ‘{‘ I didn’t close it. Thank you for your reply!
here I am it is me: ) Thanks for creating video about me :)
my red and green come up at d same time how do i fix dis
Very good ur good teacher bhudau 😂
I followed your video & your written version. The Traffic Lights worked, until I installed the button & modified the sketch. Getting an Error Message
"Error compiling for board Arduino Nano". I'm using a Arduino Nano. Any thoughts? Please
how does the arduino board know to start with only the green pin at high and then all other pins low for 15s???
because of magic
Question, can the same logic work for an station indicator e.g Indicator light change to Red, green or yellow based on a on a DB field, my db is MSSQL, i want to do this project and looking for some inspirations
does the code work on Matlab?
red and yellow not turning on on sametime
Thank you very much
Can I buy this kit online
why use 6 resistor 220 when u just use 4 resistor in the video
i remember doing this back in year 7
I just bought a real traffic light. As in a full size real stoplight. Could code like this be used to control the lights so that it doea more than just display all the lights on all the time?
In theory, yes, but it depends on how your traffic light is wired up. If it designed to show them all at once, it could be that there's only a single light source in there, with three different colored lenses. Alternatively, you could wire up your own LED light sources behind each section?
@@MakeUseOf I'll be picking it up in a few hours. I'll dig in and explore it more soon. I'm guessing it has 3 different light sources and that someone did a bit of rewiring so that all 3 lights stay on constantly.
Could we extend the time duration of light
yellow and red turn on before the green turns on
Nice Video, but do you know how to make a junction with four traffic lights. I have suceed with two lights but i don't know how to make with four.
Wouldn't that just be another set of each lights? Just a case of adding more LEDs to the same pins, you wouldn't need to adjust the coding, unless you wanted specific code for turning left/right stages?
Thank you for the reply. Two are in a row and two in the bottom. I need to know how to make right left stages
@MakeUseOf The code only works for two traffic Lights
Code ??
You said 10 kohm resistor at 6:07 but the color band in the picture diagram show only 1 kohm resistor (brown,black,red)... 10 k ohm resistor should be brown, black, yellow
You can make a counter feom 1 to 4, one up every 5 seconds for example. Then say that green is on when counter is 1, yellow is on when counter is 2 or 4 and red is on when counter is 3.
That's a good approach!
I would love to create something along those line for a model railway signal triggered by an IR obstacle sensor but I have not got a clue how to modify the code.
This was my first project, having never touched an Arduino before. It's easy once you dive in!
I manage to write the code for the two traffic lights and a single button to control them, took me a while to sort the code out though...
I know this is probably unrelated, but I've been trying to find a tutorial for a Verilog code that does this exact same thing, simulate a single traffic light using the LEDs on the FPGA board. Do you have any idea where I can find such a tutorial ?
AllInTheManual I’m looking for that as well
Could you connect this to an actual set of light bulbs and have it do the same thing?
Sure, but you'd need a relay if the lightbulbs are running on AC power, and I wouldn't suggest playing with AC power if this is your first Arduino project!
Can you pls do a fading light video
I have the Elegoo Uno R3 starter it as well. However, I had some issues with the code. For some strange reason, the lights were not operating as described in the code. I ended up having to put the OPPOSITE values for on and off.
example:
void changeLights(){
// green off, yellow on for 3 seconds
digitalWrite(yellow, LOW);
digitalWrite(red, HIGH);
digitalWrite(green, HIGH);
delay(3000);
If I did not enter the values of each pin, the LED would stay on if I wanted it off. I had hand-typed the code as you have it on your website, copied/pasted as well. but only got the desired results when I changed the values as given.Also, this always starts with yellow every time. I know, right? Strange, but true.
Please provide the source code
Apologies, our theme broke the source code. Please check the link in the description in a few days, it should be working again soon.
I use the switch button for it
And for code the “if” statement method
👍🏼
👍🏼😡
lmao copyright