Skip to content

Commit 8b71d8e

Browse files
committed
Copy edit
1 parent b31e167 commit 8b71d8e

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

distance.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
# Ultrasonic distance sensor
22

3-
In air, sound travels at a speed of 343 meters per second. An ultrasonic distance sensor sends out pulses of ultrasound (inaudible to humans) and detects the echo that is sent back when the sound bounces off a nearby object. It then uses the speed of sound to calculate the distance from the object.
3+
In air, sound travels at a speed of 343 metres per second. An ultrasonic distance sensor sends out pulses of ultrasound which are inaudible to humans, and detects the echo that is sent back when the sound bounces off a nearby object. It then uses the speed of sound to calculate the distance from the object.
44

55
![Ultrasonic distance sensor](images/ultrasonic-distance-sensor.png)
66

77
## Wiring
88

9-
The circuit connects to two GPIO pins (one for echo, one for trigger), the ground pin and a 5V pin. You'll need to use a pair of resistors (330Ω and 470Ω) as a potential divider:
9+
The circuit connects to two GPIO pins (one for echo, one for trigger), the ground pin, and a 5V pin. You'll need to use a pair of resistors (330Ω and 470Ω) as a potential divider:
1010

1111
![wiring](images/wiring-uds.png)
1212

1313
## Code
1414

1515
To use the ultrasonic distance sensor in Python, you need to know which GPIO pins the echo and trigger are connected to.
1616

17-
1. Open Python 3
17+
1. Open Python 3.
1818

1919
1. In the shell, enter the following line to import `DistanceSensor` from the GPIO Zero library:
2020

@@ -36,7 +36,7 @@ To use the ultrasonic distance sensor in Python, you need to know which GPIO pin
3636
ultrasonic.distance
3737
```
3838

39-
You should see a number: this is the distance to the nearest object, in meters.
39+
You should see a number: this is the distance to the nearest object, in metres.
4040

4141
1. Try using a loop to print the distance continuously, while waving your hand in front of the sensor to alter the distance reading:
4242

@@ -61,7 +61,7 @@ As well as being able to see the distance value, you can also get the sensor to
6161
print("Out of range")
6262
```
6363

64-
Now wave your hand in front of the sensor and it should rotate between showing the message "In range" and "Out of range" as your hand gets closer and further away from the sensor. See if you can work out the point at which it changes.
64+
Now wave your hand in front of the sensor; it should switch between showing the message "In range" and "Out of range" as your hand gets closer and further away from the sensor. See if you can work out the point at which it changes.
6565

6666
1. The default range threshold is 0.3m. This can be configured when the sensor is initiated:
6767

0 commit comments

Comments
 (0)