Things You'll Need
Instructions
Build a robot out of your Lego pieces. Connect two motors with wheels to ports B and C on the NXT brick so your robot can move towards sounds. Connect the sound sensor to port 2. Make sure the sound sensor faces the front of the robot so that it will detect sound in front of it.
Open the Lego Mindstorms NXT program on your computer. Start a new program.
Connect a loop control to the start of your program. You will use this loop to have your robot continuously listen for noise and drive forward when it does.
Connect another loop control within the first one and change the control type to "Logic." Within this loop, connect a move control, a timer control, a sound sensor control and a logic control. Change the timer and sound sensor controls to use logic.
Use the thread to connect the timer to port A on the logic control and the sound sensor to port B on the logic control. Connect the result port to the loop condition port of the loop control.
Click on the motor control. Drag the "steering" option to the left, which will make your robot turn in this direction. Change the duration to 90 degrees. Click on the sound sensor. Drag the "compare" option to the left. This will make your robot respond to louder noises.
Connect a "Move" control to the outside of the inner loop. Change the power to "100" and the duration to five seconds. This will make your robot drive forward after it hears a noise.
Plug your robot into the computer using your Mindstorms USB cord. Click the "download" button to download your program to your robot. Disconnect your robot from the cord when the program finishes downloading.
Put your robot on the ground and press the "run" button to start the program. Your robot will start turning to the left to listen for you. Move away from the robot and make noises. When the robot faces you, it will hear your noise and move towards you. Move somewhere else and try again.