This day, we’ve continued to create programs for the distance sensor. We’ve encountered trouble because of syntaxes in our program. However, we’ve changed our code and we’ve managed to make sounds. The sound emitted depends of the distance. To observe this change, the frequency is not the same :
- if there is something above 3m, the distance sensor won’t produce a sound
- if there is something between 2 and 3m, the buzzer will make a sound of 0.01kHz frequency
- if there is something between 1 and 2m, the buzzer will send a 0.1kHz frequency
- if there is something below 1m, the buzzer will send a 10kHz frequency
It was reacting quite well when there is something in front of the distance sensor, but we had some trouble with greater distance.
We continued at home to test if everything was working.
Here is our program