NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.
Microcontroller Programming » Simple Traffic Light Souce Code In C
August 08, 2009 by Nerdful_com |
This code is written in C using no libnerdkits include files.
|
---|---|
August 08, 2009 by Nerdful_com |
I know there is another traffic light sample that NerdKit staff provide. I made this one up (wihout source code from someone else) so it uses less of the MCUs processing power. No LCD and no mathematics to use up limited resources. I could infact replace the Atmega168 chip with an Atiny chip (smaller, cheaper and less features) if I was to market say a signal light set for a train collector. The functions are just timed events that get looped infinitely. Here is an exciting video showing the traffic lights application running with our embedded microcontroller (MCU), few wires, LEDs etc (less than 5 dollars in parts, could be cheaper with smaller MCU). The resistor near bottom center of breadboard (see photograph above) was left in by accident from LCD I had hooked up earlier (not needed in this layout). My next task is to figure out PMW for flashing lights and slowing/speeding up normal DC motors. I have some servos and stepper motors on order (will be saving old electronics for parts in the future). |
August 09, 2009 by Nerdful_com |
Here's code for a 1 way traffic light that is much cleaner and simpler for me to understand:
|
August 09, 2009 by Nerdful_com |
Oops, tiny error (but it still works), code redo:
|
Please log in to post a reply.
Did you know that you can connect a computer keyboard to your microcontroller? Learn more...
|