Arduino Traffic Light Tutorial

Поделиться
HTML-код
  • Опубликовано: 10 сен 2024

Комментарии • 56

  • @Beni-c4b
    @Beni-c4b 11 месяцев назад +3

    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!

  • @wag-on
    @wag-on 3 года назад +9

    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?

    • @wannarockful
      @wannarockful 2 года назад +1

      a microcontroller SDK

    • @shmurga
      @shmurga Год назад +1

      I’m sorry but you didn’t #ratio

    • @AKGaming-sr5qm
      @AKGaming-sr5qm Год назад

      Where u belong to means which country 😅

  • @davidd2661
    @davidd2661 4 года назад +5

    i made it myself and it worked :)

  • @hadireg
    @hadireg 4 года назад +1

    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.

    • @MakeUseOf
      @MakeUseOf  4 года назад

      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

  • @guruprasadkulkarni635
    @guruprasadkulkarni635 2 года назад

    how can i add another 4 led to make traffic signal?

  • @reinsaris
    @reinsaris 4 года назад +1

    8:10 when i compile changeLights()" on line 22 gives an error 'expected ')' before ';' token'. does anyone knows how to fix this?

    • @MakeUseOf
      @MakeUseOf  4 года назад +1

      Have you ended all lines with ; ?

    • @reinsaris
      @reinsaris 4 года назад +1

      MakeUseOf I found out what i was doing wrong, after an earlier ‘{‘ I didn’t close it. Thank you for your reply!

  • @IOTmug
    @IOTmug 3 года назад +2

    here I am it is me: ) Thanks for creating video about me :)

  • @habibsaliu6208
    @habibsaliu6208 3 года назад

    my red and green come up at d same time how do i fix dis

  • @AKGaming-sr5qm
    @AKGaming-sr5qm Год назад

    Very good ur good teacher bhudau 😂

  • @dane7205
    @dane7205 3 года назад

    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

  • @louisferreira1012
    @louisferreira1012 4 года назад

    how does the arduino board know to start with only the green pin at high and then all other pins low for 15s???

  • @MelinyanisoMapi
    @MelinyanisoMapi 3 года назад

    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

  • @darwinbelliard9664
    @darwinbelliard9664 3 года назад

    does the code work on Matlab?

  • @AviationMaker
    @AviationMaker 11 месяцев назад

    red and yellow not turning on on sametime

  • @official_prxalloteyezhpdsi6009
    @official_prxalloteyezhpdsi6009 2 года назад

    Thank you very much

  • @pranabdeka209
    @pranabdeka209 3 года назад

    Can I buy this kit online

  • @alifsaifuddin6192
    @alifsaifuddin6192 3 года назад

    why use 6 resistor 220 when u just use 4 resistor in the video

  • @anemcnes193
    @anemcnes193 2 года назад

    i remember doing this back in year 7

  • @AnthonyGoodley
    @AnthonyGoodley 3 года назад

    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?

    • @MakeUseOf
      @MakeUseOf  3 года назад

      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?

    • @AnthonyGoodley
      @AnthonyGoodley 3 года назад

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

  • @funasfriend150
    @funasfriend150 3 года назад +1

    Could we extend the time duration of light

  • @christiancasasos2771
    @christiancasasos2771 2 года назад

    yellow and red turn on before the green turns on

  • @ahmedkahie6009
    @ahmedkahie6009 3 года назад

    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.

    • @MakeUseOf
      @MakeUseOf  3 года назад +1

      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?

    • @ahmedkahie6009
      @ahmedkahie6009 3 года назад

      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

    • @ahmedkahie6009
      @ahmedkahie6009 3 года назад

      @MakeUseOf The code only works for two traffic Lights

  • @luomnguyenvan1479
    @luomnguyenvan1479 4 года назад +1

    Code ??

  • @galileib08icasiamcyruzstev45
    @galileib08icasiamcyruzstev45 3 года назад

    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

  • @onnio7998
    @onnio7998 3 года назад

    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.

    • @MakeUseOf
      @MakeUseOf  3 года назад

      That's a good approach!

  • @nickhale2900
    @nickhale2900 4 года назад

    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.

    • @MakeUseOf
      @MakeUseOf  4 года назад

      This was my first project, having never touched an Arduino before. It's easy once you dive in!

  • @user-hw6iy4wu9j
    @user-hw6iy4wu9j Год назад

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

  • @enzo991_
    @enzo991_ 5 лет назад

    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 ?

    • @thad4342
      @thad4342 4 года назад

      AllInTheManual I’m looking for that as well

  • @josevaldivia9908
    @josevaldivia9908 4 года назад

    Could you connect this to an actual set of light bulbs and have it do the same thing?

    • @MakeUseOf
      @MakeUseOf  4 года назад +3

      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!

  • @stephanfouche7374
    @stephanfouche7374 4 года назад

    Can you pls do a fading light video

  • @JerryKillian
    @JerryKillian 4 года назад

    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.

  • @irinaktersnigdha5083
    @irinaktersnigdha5083 Год назад

    Please provide the source code

    • @MakeUseOf
      @MakeUseOf  Год назад

      Apologies, our theme broke the source code. Please check the link in the description in a few days, it should be working again soon.

  • @shehnazmasarweh1526
    @shehnazmasarweh1526 2 года назад

    I use the switch button for it
    And for code the “if” statement method

  • @monstrousdemon4565
    @monstrousdemon4565 4 года назад

    👍🏼

  • @monstrousdemon4565
    @monstrousdemon4565 4 года назад

    👍🏼😡

  • @dlegendarypro
    @dlegendarypro 3 года назад

    lmao copyright