Francesco Vannini
Published © GPL3+

Anavi Buttons and Traffic light

Quickly add buttons and LEDs directly onto the GPIO header of your Raspberry Pi to get on with some teaching, quick coding, debugging, etc.

IntermediateProtip30 minutes768
Anavi Buttons and Traffic light

Things used in this project

Hardware components

Raspberry Pi 3 Model B
Raspberry Pi 3 Model B
×1

Software apps and online services

Raspbian
Raspberry Pi Raspbian

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)

Story

Read more

Code

Code snippet #1

Plain text
#!/usr/bin/env python3

from gpiozero import Button
from time import sleep

btnB1 = Button(13)
btnB2 = Button(19)
btnB3 = Button(26)

print("ANAVI Buttons")
print("---")
print("Please press a button")
print("---")

while True:
    sleep(0.1)
    if btnB1.is_pressed:
        print("B1")
    if btnB2.is_pressed:
        print("B2")
    if btnB3.is_pressed:
        print("B3")

Code snippet #2

Plain text
#!/usr/bin/env python3

from gpiozero import LED
from time import sleep

ledRED = LED(13)
ledYELLOW = LED(19)
ledGREEN = LED(26)

while True:
    ledRED.on()
    sleep(4)
    ledRED.off()
    ledGREEN.on()
    sleep(3)
    ledYELLOW.on()
    sleep(1)
    ledYELLOW.off()
    ledGREEN.off()

Github

https://github.com/AnaviTechnology/anavi-buttons

Github

https://github.com/AnaviTechnology/anavi-traffic-lights

Credits

Francesco Vannini

Francesco Vannini

9 projects • 19 followers

Comments