Class Activity - Create proximity-based audio alerts using laser ping sensor
Create a script that:
distance); please note the sensor is connected to pin 15.distance: 10 cm).
| No. | Conditions | Action |
|---|---|---|
| 1 | If distance ≥ 50 cm |
Nothing (speaker is OFF) & Print( "distance > 50") in terminal |
| 2 | If 30 ≤ distance < 50 cm |
Play a sound (e.g., techloop.wav) with volume 7& Print( "30 ≤ distance < 50") in terminal |
| 3 | If distance < 30 cm |
Play a sound (e.g., techloop.wav) with volume 10& Print( "distance < 30") in terminal |
techloop.wav from Canvas, or you can download a sound from the Sound Library.wav) onto the SD card of the activity board.distanceUse the following approach to play audio files:
Submit your code saved as a *.svg file with appropriate naming convention:
Lab5_YourInitials_DescriptiveName (e.g., Lab5_AM_distance_audio)