I bought a Lego NXT kit a couple of years ago, but beyond getting it to run around vaguely bumping into things and getting stuck, I’ve never really done much with it.
The main problem was the software. The NXT comes with a graphical programming environment called NXT-G. It’s a lovely idea and works really well for simple things. But if you want to do anything at all beyond that it starts to become a serious headache. You end up with wires and blocks and all sorts of things all over the place, mostly not actually viewable without doing some serious scrolling around.
Call me old-skool, but I like to code with words in a text editor. I can see that the NXT is aimed mainly at kids (including big kids), so the thinking seems to have been that kids can’t read or something. I’m not sure. When I was a kid I coped very happily with BASIC.
So my search led me to the leJOS website. leJOS is basically a cut-down version of java with some NXT classes thrown in. Finally I could code in words, in a way that I’m used to. Finally I could write more sophisticated programs than ‘move forwardu till you hit something, then stop’. Hoorah!
But that’s when the apathy hit me, as it probably has done with many a self-taught student before me. It’s all very well having the resources, but do I have the time to work out what it’s all about? Where do I start? Without any course, books, ideas, or structure it can be hard to do anything much.
Brian Bagnall’s excellent (if occasionally buggy) Maximum LEGO NXT: Building Robots with Java Brains came in.
It tells you about the NXT brick and bluetooth, how to write code for the NXT, and even some ideas for building robots that do interesting things. The first one you get to build (see my photo above) moves around until something blocks its path. It then scans around for an open path, and heads off in that direction. A nice example, and only a few lines of code. How you’d code that graphically I daren’t even begin to think. A tangled mass of data wires and blocks, probably.
Time to build my first Turtle!