u4099 created page: Template authored by Daniel Jung Moltzen's avatar Daniel Jung Moltzen
...@@ -230,7 +230,7 @@ public class TinesPartyRobot { ...@@ -230,7 +230,7 @@ public class TinesPartyRobot {
The code we have implemented uses three steps; one for driving forward, one for driving left and for driving right. We subtract the two sound levels from the microphones, to see which one of the microphones that registres a higher sound level than the other. We store this new value in a variable and uses it to determine in which direction the robot should drive. If the variable is higher than 7 the robots turns right, if it lower than -7 the robot turns left, and if the value is positive and lower or equal to 7 the robot drives forward. The last step is implemented so that it drives forward when the two microphones registres almost the same level. The code we have implemented uses three steps; one for driving forward, one for driving left and for driving right. We subtract the two sound levels from the microphones, to see which one of the microphones that registres a higher sound level than the other. We store this new value in a variable and uses it to determine in which direction the robot should drive. If the variable is higher than 7 the robots turns right, if it lower than -7 the robot turns left, and if the value is positive and lower or equal to 7 the robot drives forward. The last step is implemented so that it drives forward when the two microphones registres almost the same level.
### Overall Conclusion ### Overall Conclusion
Though the lab lesson, we have tested sound sensing in different ways, eg. how to only react to a clap sound. Further we have experimented with how the microphone reacts to different distances to a sound source. These test were implemented as a way of controlling the car (robot nxt). It all went rather well, however we ran into some problems regarding the buttonlistener implementation but found a way to solve it. Furthermore, we had a finding we could not explain in regards to measuring sound level at different distances.
### References ### References
1. leJos tutorial, [Threads, Listeners and Events.](http://lejos.sourceforge.net/nxt/nxj/tutorial/ListenersAndEvents/Listeners_Events.htm) 1. leJos tutorial, [Threads, Listeners and Events.](http://lejos.sourceforge.net/nxt/nxj/tutorial/ListenersAndEvents/Listeners_Events.htm)
... ...
......