Main content
Electrical engineering
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:
Next let's build on loops to create a night vision device.
Want to join the conversation?
- Can you make a actual city (life sized) out of Legos(14 votes)
- Five or six have already been built. They are called legolands.(11 votes)
- how much does a new Mindstorm cost?(12 votes)
- You ant buy new ones on LEGO.com anymore... But, you can buy the Ev3(3.0) kit for 349.99USD(6 votes)
- Are they going to upgrade tutorials to include EV3 programming?(8 votes)
- If you make a robot how are you going to make it move?(3 votes)
- Program it. If you started the "JS: Drawing and Animation" course it said that programming controls even Google's self-driving cars.(2 votes)
- Can we make fighting robots with belt of lego(2 votes)
- Do you wire your Lego device into the computer?(1 vote)
- yes, you need to wire it. Or you can use bluetooth or wifi(2 votes)
- I am hoping to get the newer version of Lego robots mindstorms EV3 so can you teach EV3 not NXT because EV3 is becoming very very popular(1 vote)
- i love robots too, and i aggree with you. it is becoming more popular...(1 vote)
- Where can I buy a cheap NXT?(1 vote)
- www.amazon.co.uk or www.eBay.co.uk or people selling second hand 1s from www.facebook.com(1 vote)
- How do you put a loop inside of a loop?(1 vote)
- Do you have a programming games and websites to play on(1 vote)