With the NXT 1.26 (don't use that version!) and 1.28 firmware, you can write simple programs directly on the NXT brick. This is really handy for activities where you need the NXT to just do simple tasks - where the main goal is construction, rather than programming. It's under the "NXT Program" icon. Press .
Now we're ready to program. Press .
1 : Action (move forward, backward, turn, or make a sound).
Block 2 : Wait-For (time or sensor).
Block 3 : Action - same as before.
Block 4 : Wait-For - same as before.
Block 5 : Stop or Loop.
An example program might be:
1 - Move forward.This program will make the robot wander around the room until the dog finds it and starts chewing on it, or something like that.
2 - Continue moving until the touch sensor is pressed.
3 - Back up turning right for 2 seconds.
4 - (empty)
5 - Loop "forever".
We'll now step through the process of building a program.
When the condition is satisfied (for example, the touch sensor is pressed), the movement (and the only possibility is movement) chosen in the previous block is canceled. "Don't wait" can be confusing, because the motors will immediately stop. So, if the motor runs for just a fraction of a second and stops, you've probably chosen a "run until" in an action block followed by a "don't wait" in the next block. You should only choose "don't wait" when the previous action was a timed movement or sound.
Choose your wait-for condition, then press .
The next two blocks (3 and 4) are exactly the same as 1 and 2. So, for example, you could choose "forward 5 seconds, wait 2 seconds, backward 5, wait 2 seconds".
The last block lets you choose what happens when the first four blocks have finished. You've got two choices: stop and loop. Stop means just that - run the first four blocks and then stop. This will be fine for many situations, but is also useful when you're debugging a program that you plan to have loop.
Loop means to keep running the first four blocks, over and over - forever. Or, at least until the batteries run down.
Choose whether to stop or loop, then press .
The other two choices are to go back to the main NXT menu - forgetting about the program or to save the program. Personally, I don't find the save option to be very interesting, because it takes longer to enter the name for the program than to re-create the program.
I hope that you've found this tutorial helpful.
NeXT Tools for Mac OS X, an open-source project. Those screen shots actually end up in gray scale. I massaged them into black-and-white, then changed the background color to green, using GraphicConverter.