Sonic Sensor Add-On

This add-on uses ultrasonic sound waves to see how far away an object is. This is the same technology that submarines and bats use to see their surroundings. Sounds cool!

See the two things that look like eyes? One of them is an ultrasonic transmitter (think "sender") and the other is an ultrasonic receiver (think "listener"). The sender sends out a sound wave. This wave keeps going until it hits and object. Then some of the sound bounces back, and the listener hears it. The farther away the object is, the longer it will take the sound wave to bounce back and get picked up by the listener. This add-on uses that timing to calculate how far in front of the sensor the nearest object is.

Main Function

awesome.port1.sonicSensor.reading()

Gets a reading from the ultrasonic sensor.

Returns

It returns an int, which is the distance from the sensor to the nearest object that is in front of it. This distance is in centimeters.

Example

// turns on the LED if the closest object is less then 100cm away, turn on the LED if ( awesome.port1.sonicSensor.reading() < 100 ) { awesome.LED.turnOn(); }

Tips

The LED sting is fun for decorating things! You can use it as a festive decoration, or to add some dazzling lights to any project.

x

Goodbye and thanks for all the fish,

Thanks for helping us Kickstart Awesome Shield and learning with us. Sadly, turning Awesome Shield into a sustainable business didn’t work out and so we’re in the process of officially shutting down the company.

Read our full letter.

If you have an Awesome Shield you can keep using it and the learning platform.


Close Message