door chime

The next program you’ll create is a simple door chime: You load it onto your TriBot, and place the TriBot at a doorway with the Ultrasonic Sensor facing the opening. The TriBot will chime when someone walks through the door and then start over in preparation for the next person.

When writing a program that loops around like this, it doesn’t matter whether you start with the Loop block and build the program inside the loop or wait until the program works once and then add the Loop block. For this example, you’ll start with the Loop block and build the program inside it:

  1. Create a program with the name DoorChime.

  2. Add a Loop block to the Sequence Beam. For this program, the loop should continue until the program is stopped, so you don’t need ...

Get The Art of LEGO MINDSTORMS NXT-G Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.