7
8
9
10
11
12
13
14
15
16
17
18
17.429220265355603
cm
18.73230112010035
cm
20.717752390894397
cm
19.83807004731277
cm
17.3059003106479
cm
^CTraceback (most recent call last):
File
"/usr/local/bin/grove_ultrasonic_ranger"
, line
11
, in <module>
load_entry_point(
'grove.py==0.5'
,
'console_scripts'
,
'grove_ultrasonic_ranger'
)()
File
"/usr/local/lib/python3.5/dist-
packages/grove/grove_ultrasonic_ranger.py"
, line
107
, in main
time.sleep(
1
)
KeyboardInterrupt
When you change the distance between the Grove - Ultrasonic Ranger and the target object, the measurment value will change accordingly.
Press
Ctrl
+
C
to quit.
Attention
For most grove module, you need to add the pin number parameter, like
grove_ultrasonic_ranger 5 6
,
5
and
6
are the
GPIO/BCM pin. However, you may have noticed that in the first example
grove_pwm_buzzer
, we didn't add a parameter after the
command. This is because the PWM port and I2C port do not require pin number parameters. You can find the pin number silkscreen just
besides the Grove sokect.
Analog Port
We will take the
Grove - Air quality sensor v1.3
for example to introduce the Analog port.
Hardware connection diagram
Tap the following command
grove_air_quality_sensor_v1_3 0 1
in the command line interface.