Real-World Link
Modern vehicles are smart. They have backup cameras and assisted parallel
parking and will even beep at you if an object is too close to the car. This is how an
ultrasonic sensor works!
Careers: car designer, sound engineering technician, sonar technician
STEM Connections
• Science
Ĕ Sound waves
Ĕ Reflection of sound waves
• Technology
Ĕ Frequency
Ĕ Sound digitization
• Engineering
Ĕ Sonic measurements
Ĕ Sonar
• Math
Ĕ Distance
Ĕ Comparison symbols
Block-Text Correlation
void setup() {
pulse.PulseBegin();
void loop() {
if (pulse.readSonicSensorCM(3) > 10) {
pulse.setRedLED(LOW);
pulse.setYellowLED(HIGH);
} else if (pulse.readSonicSensorCM(3) < 10) {
pulse.setRedLED(HIGH);
pulse.setYellowLED(LOW);
Note: This program uses the math values of greater than (>) and less than (<). A specific
LED will be lit depending on whether the output value is greater than or less than 10.
Arduino Source Code
#include <PULSE.h>
PULSE pulse;
void setup() {
pulse.PulseBegin();
}
void loop() {
if (pulse.readSonicSensorCM(3) > 10) {
pulse.setRedLED(LOW);
pulse.setYellowLED(HIGH);
} else if (pulse.readSonicSensorCM(3) < 10) {
pulse.setRedLED(HIGH);
pulse.setYellowLED(LOW);
}
}
44 Getting Started Activities