PyRaspBeta

← All practice problems

Raspberry Pi practice problem · Motors & actuators

Quiet mode

EasyBudget $4Python · gpiozero

An active buzzer on GPIO23 (may draw up to 25 mA). Sound it at full volume for the first 2 s, then at about 30 % volume (anything from 20 % to 45 % passes) for 2 s, then switch it off.

An active buzzer plays its own fixed pitch; PWM on its pin only chops the sound, so the duty cycle sets the volume. gpiozero.PWMOutputDevice with value = 0.3 does it.

More in Motors & actuators