Control the buzzer

1. API Introduction

The API corresponding to RGB lights is:

Arm_Buzzer_On(delay=255)

Function: turn on the buzzer.

Parameter explanation:

delay: The input range of delay is 1~50. The larger the value, the longer the buzzer sounds. It will automatically turn off after timeout. The delay time is specified: 1=100 milliseconds, 2=200 milliseconds, and so on, up to the maximum The delay time is 50=5 seconds. If delay does not pass in a value or delay=255, it means that the buzzer beeps for a long time and needs to be turned off manually. Return value: None.

Arm_Buzzer_Off()

Function explanation: Turn off the buzzer.

Parameter explanation:

No parameters are passed in.

Return value: None

2. Start Docker

After entering the Raspberry Pi 5 desktop, open a terminal and run the following command to start the container corresponding to Dofbot:

Access Jupyter Lab within Docker:

3. Code content

Code path:/root/Dofbot/3.ctrl_Arm/2.beep.ipynb

Open the 2.beep.ipynb file from jupyter lab, and click the Run entire notebook button on the jupyter lab toolbar. You can hear the buzzer on the expansion board beep three times in a row, and the sounds at the back are louder than the front. The sound is longer.

It will automatically exit after running.