EasyManua.ls Logo

Freenove 4WD Smart Car Board for Raspberry Pi

Default Icon
132 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Need support? support.freenove.com
76
Chapter 3 Module test (necessary)
Buzzer
Run the program
Enter the following command in the terminal to test buzzer.
If the terminal displays the directory as below (where test.py is located). You can directly execute the test.py
command.
1 If not, execute the cd command:
cd ~/Freenove_4WD_Smart_Car_Kit_for_Raspberry_Pi/Code/Server
2 Execute test.py command:
sudo python test.py Buzzer
Result:
The buzzer will be turned on and last for 3s. Then the program will automatically end or you can press "Ctrl
+ C" to end the program.
The code is as below:
1
2
3
4
5
6
7
8
9
10
11
12
from Buzzer import *
buzzer=Buzzer()
def test_Buzzer():
try:
buzzer.run(cmd.CMD_START)
time.sleep(1)
print "1S"
time.sleep(1)
print "2S"
time.sleep(1)
print "3S"
buzzer.run(cmd.CMD_STOP)