User Tools

Site Tools


marvin:lab3

This is an old revision of the document!


Lab rapport 3

Lesson 3

In this lesson we will use the NXT sound sensor to turn the LEGO 9797 car into a sound controlled car.

Test of the Sound Sensor The purpose of this test is to make a simple test of the microfon sensitivity to sound coming from different directions. The Microfon is placed in the center of a closed room of 3x3m and a keybunddle is used as our sound generator. It was found that clapping with hands made greater variance to the sound level, while the noise from the keybunddle proved to give quite constant sound levels.

SoundSensor s = new SoundSensor(SensorPort.S1);
int soundLevel;
 
LCD.drawString("Level: ", 0, 0);
 
while (! Button.ESCAPE.isPressed()) {		   
    soundLevel = s.readValue();
    LCD.drawInt(soundLevel,3,7,0);
    LCD.refresh();
 
    Thread.sleep(5);
}
marvin/lab3.1221814042.txt.gz · Last modified: 2008/09/19 10:47 by rieper