Pibrella Buzzer

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.buzzer.buzz(440)

sleep(3)

pibrella.buzzer.buzz(1000)

sleep(2.5)

pibrella.buzzer.off()

sleep(3)

pibrella.buzzer.fail()

sleep(3)

pibrella.buzzer.success()

sleep(3)

pibrella.buzzer.off()

sleep(3)

pibrella.buzzer.note(200)

sleep(3)

pibrella.buzzer.off()

#This allows you to use the Pibrella commands

#This allows you to use sleep commands from the time library

#Buzz at frequency 440hz

#waits 3 seconds

#Buzz at frequency 1000hz

#Wait 2.5 seconds

#Turn buzzer off

#Wait 3 seconds

#Play preset sound called fail

#Wait 3 seconds

#Play preset sound called success

#Wait three seconds

#Turn buzzer off

#Wait three seconds

#Can be positive or negative numbers (0 is A at 440Hz)

#Wait three seconds

#Turn buzzer 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 buzzer with a button look at if else and Pibrella buttons page