Welcome to DOFBOT Pro repository
2. Control Buzzer
Control Buzzer
1. API Introduction
The API corresponding to the buzzer 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 automatically turns off after timeout. Delay time specification: 1=100 milliseconds, 2=200 milliseconds, and so on, with the maximum delay time being 50=5 seconds. If no value is passed for delay or delay=255, it means the buzzer sounds continuously and needs to be manually turned off.Return value: None.
Arm_Buzzer_Off()
Function: Turn off the buzzer.
Parameter explanation:
xNo input parameters.Return value: None
2. Code Content
Code path:
xxxxxxxxxx~/dofbot_pro/dofbot_ctrl/scripts/02.beep.ipynb
xxxxxxxxxx#!/usr/bin/env python3#coding=utf-8import timefrom Arm_Lib import Arm_Devicexxxxxxxxxx# Get the robotic arm objectArm = Arm_Device()time.sleep(.1)xxxxxxxxxx# Buzzer automatically sounds for 100 milliseconds then turns offb_time = 1Arm.Arm_Buzzer_On(b_time)time.sleep(1)xxxxxxxxxx# Buzzer automatically sounds for 300 milliseconds then turns offb_time = 3Arm.Arm_Buzzer_On(b_time)time.sleep(1)xxxxxxxxxx# Buzzer sounds continuouslyArm.Arm_Buzzer_On()time.sleep(1)xxxxxxxxxx# Turn off the buzzerArm.Arm_Buzzer_Off()time.sleep(1)xxxxxxxxxxdel Arm # Release the Arm objectOpen the code 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 sound three times in succession, with each subsequent sound being longer than the previous one.

It will automatically exit after running completes.