Pibrella Lights

Code on this page controls the three built in LED lights on the Pibrella Board

Make sure Python 3 on the Raspberry Pi is updated and that you have the latest Pibrella library first.
Open idle3 for python as an administrative user
You can access both these commands from the Pibrella Update Pi page.
import pibrella
from time import sleep
pibrella.light.red.on()
sleep(3)
pibrella.light.amber.on()
sleep(2.5)
pibrella.light.red.off()
pibrella.light.amber.off()

#This allows you to use the Pibrella commands
#This allows you to use sleep commands from the time library
#Turns red LED on
#waits 3 seconds
#Turns amber light on
#Wait 2.5 seconds
#Turn red LED off
#Turn amber LED off
If you want to repeat code a set number of times look at the for i in range() page
If you want to repeat code until a condition is fulfilled look at the while page
If you want to control your lights with a button look at if else and Pibrella buttons page

Other LED light controls
pibrella.light.amber.blink(1,1)
pibrella.light.red.blink(0.1,0.1)
#Make the amber light blink one second on and one second off
#Make the red light blink one tenth of a second on and one tenth of a second off

Comments