If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content

Warm up: police siren

Getting comfortable

This article assumes you successfully downloaded a test program to your NXT as shown in the previous video. This means you can make your robot 'beep' once or twice. Next let's build some confidence while covering a fundamental concept in programming: Loops. We will also use the touch sensor.

Loop blocks

So far we have created a program which output a single tone, or single sequence of tones. What if we want to repeat sounds, such as a police siren?
If you want to repeat a behaviors you will need to put them inside a loop block which looks like this:
The following video demonstrates the loop block in action. It explains how to nest loops as well as how to control a loop using your touch sensor:
Khan Academy video wrapper
Next let's build on loops to create a night vision device.

Want to join the conversation?