StackBot/src/Sensor/scripts/buzzer_control.py

24 lines
443 B
Python
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env python3
import hiwonder
import time
"""
控制蜂鸣器
"""
def main():
while True:
#jetmax上的蜂鸣器为有源蜂鸣器只能控制开关不可控制音调
for i in range(5):
hiwonder.buzzer.on() #打开蜂鸣器
time.sleep(0.1) #
hiwonder.buzzer.off() #关闭蜂鸣器
time.sleep(0.1)
time.sleep(1)
if __name__ == "__main__":
main()