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
After entering the Raspberry Pi 5 desktop, open a terminal and run the following command to start the container corresponding to Dofbot:
xxxxxxxxxx
./Docker_Ros.sh
Access Jupyter Lab within Docker:
xxxxxxxxxx
IP:9999 // Example: 192.168.1.11:9999
Code path:/root/Dofbot/3.ctrl_Arm/2.beep.ipynb
#!/usr/bin/env python3
#coding=utf-8
import time
from Arm_Lib import Arm_Device
xxxxxxxxxx
# Get the object of the robotic arm
Arm = Arm_Device()
time.sleep(.1)
xxxxxxxxxx
# The buzzer will automatically sound for 100 milliseconds and then turn off.
b_time = 1
Arm.Arm_Buzzer_On(b_time)
time.sleep(1)
xxxxxxxxxx
# The buzzer will automatically sound for 300 milliseconds and then turn off.
b_time = 3
Arm.Arm_Buzzer_On(b_time)
time.sleep(1)
xxxxxxxxxx
# The buzzer keeps sounding
Arm.Arm_Buzzer_On()
time.sleep(1)
xxxxxxxxxx
# Turn off the buzzer
Arm.Arm_Buzzer_Off()
time.sleep(1)
xxxxxxxxxx
del Arm # Release the Arm object p
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.