jessvi created page: Lab6 authored by Jesper Kurtzmann Svith's avatar Jesper Kurtzmann Svith
...@@ -34,4 +34,15 @@ We started by equipping the robot with a sound sensor as seen in the picture bel ...@@ -34,4 +34,15 @@ We started by equipping the robot with a sound sensor as seen in the picture bel
##### Fig. 1 - robot with microphone ##### Fig. 1 - robot with microphone
Then we configured a SoundVehicle.java class which reads values from the sound sensor and maps the value to both motors on the robot. The code snippet[x] below shows how the program reads the sound value and maps it to the motors: Then we configured a SoundVehicle.java class which reads values from the sound sensor and maps the value to both motors on the robot. The code snippet[x] below shows how the program reads the sound value and maps it to the motors:
![fig1](http://gitlab.au.dk/uploads/group-22/lego/e8e60b9d15/fig1.jpg)
\ No newline at end of file ```
while (true) {
int soundVal = (int) (sound1.readValue() * scale);
LCD.drawString("Sound: " + soundVal, 0, 0);
LCD.refresh();
forward(soundVal, soundVal);
}
```
\ No newline at end of file