Welcome to DOFBOT-Ultra repository
2. Control Buzzer
Control Buzzer
1. API Introduction
The API for the buzzer is:
Arm_Buzzer_On(delay=255)
Function: Turns on the buzzer.
Parameter Description:
delay: The input range for delay is 1~50. The larger the value, the longer the buzzer sounds. It will automatically turn off after a timeout. The delay time rule: 1 = 100 milliseconds, 2 = 200 milliseconds, and so on. The maximum delay is 50 = 5 seconds. If delay is not passed or delay=255, the buzzer will sound continuously and needs to be manually turned off.
Return value: None.
Arm_Buzzer_Off()
Function: Turns off the buzzer.
Parameter Description:
No input parameters.
Return value: None.
2. Code
Code path:
~/dofbot_ctrl/scripts/02.beep.ipynb
xxxxxxxxxx#!/usr/bin/env python3#coding=utf-8import timefrom Arm_Lib import Arm_Devicex
# Get the robotic arm objectArm = Arm_Device()time.sleep(.1)x
# Buzzer automatically sounds for 100 milliseconds then turns offb_time = 1Arm.Arm_Buzzer_On(b_time)time.sleep(1)x
# Buzzer automatically sounds for 300 milliseconds then turns offb_time = 3Arm.Arm_Buzzer_On(b_time)time.sleep(1)x
# Buzzer sounds continuouslyArm.Arm_Buzzer_On()time.sleep(1)x
# Turn off the buzzerArm.Arm_Buzzer_Off()time.sleep(1)x
del Arm # Release the Arm objectOpen the code file from Jupyter Lab and click the "Run All Cells" button on the Jupyter Lab toolbar. You will hear the buzzer on the expansion board sound three times in succession, with each subsequent sound lasting longer than the previous one.

After execution, it will exit automatically.