Aim: The aim of this project is to create a traffic light which will start when the user presses the button. When the red light is on, a buzzer will beep constantly.

Hardware and software:

  • Raspberry Pi 3
  • Breadboard
  • Buzzer
  • Button
  • 1 red male to female wire
  • 1 red male to male wire
  • 1 black male to male wire
  • 2 black male to female wire
  • 3 green male to female wires
  • 1 blue male to female
  • 1 yellow male to female wire
  • 1 green LED
  • 1 amber LED
  • 1 red LED
  • Python 3
  • 4 resistors

First the 3 LEDs were connected to the breadboard using 3 resistors and 3 male to female wires. The button was then connected onto the breadboard using a resistor 1 male to female wire and 1 male to male wire. Lastly, the buzzer was also connected to the breadboard using 1 black male to male wire and 1 male to female wire.

 

20170404_160013.jpg

20170404_160030.jpg

20170404_160040.jpg

20170404_160043.jpg

20170404_160101.jpg

20170404_160758.jpg

diagram pic.JPG

 

code:

code 1.JPG

code 2.JPG

Advertisements