Skip to main content

Posts

Showing posts with the label My Blocks

Debugging with the NXT screen: Displaying numbers

If you're a programmer like me, your programs won't work perfectly when you run them the first time. Sometimes it's a simple mistake on the programmer's part, but sometimes the problem is not so obvious. In some cases you can analyze part of your program by displaying some of the program's variables on the NXT screen. For example, you can do this to determine whether a sensor works or not. Displaying such a number on the NXT screen is not very difficult, but it can be a bit cumbersome if there's multiple things you would like to display. To make it a little easier I'd like to share an old trick (a My Block) that will make it simple to do this. The NXT screen will show "Sensor: 47" if the ultrasonic sensor measures 47. Installation Instructions - Just open the packed example program: Click here to download. Be sure to open the file that's in the zip archive with the Mindstorms NXT-G 2.0 software. Alternatively, use "Right Click" and c...

"My Blocks" Tutorial Available

The standard NXT-G programming system for the NXT includes a feature called "My Blocks" that lets you create your own custom programming blocks. This is especially useful when developing complex programs, so that you can build up more complex actions from simpler actions that you can re-use. Although creating a simple My Block is not hard, it gets trickier to make more complex and more useful ones, and there are a number of practical concerns. For anyone wanting to learn more about My Blocks, I have posted this web tutorial , which starts at the basics and works up to more complex uses, including input and output parameters, simulating local variables, and various practical concerns such as testing and maintenance.