User Tools

Site Tools


marvin:lab3

This is an old revision of the document!


Lab rapport 3

Lesson 3

I denne øvelse skal der laves bil, der kan kontrolleres vha. mikrofonen.

Delopgave1: Test of the Sound Sensor First, you should mount the sensor on the LEGO 9797 car as described in LEGO Mindstorms Education NXT Base Set 9797 building instruction page 24 to page 26. Second, program, compile and upload a simple sensor test program similar to the SonicSensorTest.java. Place the car at a fixed position and make sounds of different loudness and at different distances. Use this to give a description of the readings from the sound sensor.

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.1221811788.txt.gz · Last modified: 2008/09/19 10:09 by deva