Programming Language(s):
- Python 3
Tiny traffic light on a breadboard controllable with a button.
To make the experience fit your profile, pick a username and tell us what interests you.
We found and based on your interests.
Programming Language(s):
trfc_light.pyPython 3 code to control the traffic light with a button.x-python-script - 2.49 kB - 12/31/2015 at 01:17 |
|
Finished version with a minor drawback
I had to move the buttons control pin from Pin 2 to Pin 8 because the pins 2 & 3 have a built-in pull resistance which I didn't know by the time I was making the projects layout.
The Python code as it is in its current state, checks the status of the button every 0.5s.
This is just an emergency solution because in the initial state of the code, the button was checked several hundred times a second (no sleep-function) which led to an issue where you press the button and the status variable changes its state to fast and therefore you ended up with weird signals.
Connect any GND pin to an empty minus-Rail on your breadboard
I prefer to use pin 39 on my RPi2B to have more structure
Connect your LEDs
Connect your Button
Create an account to leave a comment. Already have an account? Log In.
Become a member to follow this project and never miss any updates
By using our website and services, you expressly agree to the placement of our performance, functionality, and advertising cookies. Learn More