It's just a Traffic Light code, something any electronics engineer should have studied at their early stage of their universities, right? So after many try outs, I finally opted to try to ask in here for a professional guidance or even better, THE ONE OR TWO LINES OF CODE THAT I AM MISSING. BUT, I thought that in these forums I could get some easy, fast advice for a simple code like mine. My (real size) traffic light turns on already, it does the proper blinking switching from red to green, then yellow and back to red, with the assigned delays in my poor code, if you want me to be honest. I just want the traffic light as a decoration for my bar. Believe me, I wanted to solve it by myself and I've gone far, but I have encountered terms like "fushing", "rollover" and others that have confused me greatly. And I get it, people should be asking much more complicated stuff in here, therefore your second suggestion for revising how to use this forum. I've looked for the term "State Machine" which you refer me to and it seems you want me to study the whole basic concepts of electronics. I know that for an engineer I might sound stupid, but I believe this problem should be extremely easy to solve. AND FOR SOME REASON THE OUTPUT IS OPPOSITE in the lights put your main code here, to run repeatedly: This is my code: // variables where in total there are 58,200 milliseconds being assigned Bear in mind that I am no engineer, and I had to figure it all out by myself, so I'm beggin for some guidance for these last steps.Ĭan you please tell me what can I add for it to not get buggy after some minutes? thanks a lot!!!Ī link for a video with the problem been shown by minute 23:35 This is a simple code, and I've read many threads but I truly cant' understand. So I am guessing that my timing with the milliseconds is off, or something, but I simply can't understand how to flush/reset the times for it to not get all messed up after 10 minutes of work. I've read that the 5V pin is for the USB and the VIN pin is for the converter power supply, am I right?īut then the code gets stuck even when it's connected to the computer with a usb connector. But when I change it to a wall outlet using the converter power supply (with a 5volts converter) it never works, only with my USB. When I upload my code it works like a charm, just as intended. I almost have it perfected but this is truly driving me crazy, because once I get it to work, after some minutes, it goes nuts. The problem is that my code seems to have a problem with the timing of the delays, plus another issue I don't quite understand with the power supply. In my town there are no real electronic engineers, they only sell supplies but have no answers so I have built my own Arduino and got it to work. Believe me, I have read a lot of forums and checked several YouTube videos but for something as simple as a Traffic Light, I cannot understand the problem I'm facing.
0 Comments
Leave a Reply. |