Saturday, October 07, 2006

LEGO Mindstorms: the Super-Easy way to make robots. Part 1

Ok, I will take a break from the long winded Microchip tutorials for now. No, don't worry, I won't leave the fact that you need C programming for your PICs. It is just that this blog needs to focus on lighter things and different topics too, like other micros and electronic stuff.

In this post I want to tell you that the LEGO Mindstorms IS supported by your Mac. And, although it is not supported officially by the LEGO Group, it may be a good thing that you don't use their super-easy graphical programming environment. If you have never seen it, here's how a code snippet would look like:


In this partial blog post, I will describe just one of them:


1. NQC (Not Quite C)

I used this excellent bytecode compiler (the code is interpreted by the RCX firmware, not run on the processor itself) during my undergrad junior year to program a line following robot. I used an iMac with OS 8.5 back in the time, but NQC has been ported to OSX in 2004. I recommend this package if you have just outgrown the LEGO Environment and know basic C syntax.

One advantage of using the LEGO firmware to run your bytecode is that you have all the firmware functions at your fingertips, like tone generation, power modulation (PWM), sensor conditioning (this is tricky business with the LEGO sensors), and LCD handling without even worrying about includes or libraries. The LEGO Group has taken care of all that for you. Another big advantage is multithreaded execution out-of-the-box. I guarantee you will really like this feature.

However, there are a few downsides such as a 32 variable limit, integers only, and no parameter passing. You really have to try it if you own a LEGO Mindstorms set. Here's a screenshot:



MacNQC handles your serial infrared tower (RIS 1.0) with the help of a USB-serial adapter, and USB Infrared tower (RIS 2.0) after installing the appropriate drivers.

MacNQC was created by Dave Baum, and is currently maintained by K. Robert Bate. Thanks to you both for this excellent application!

Two last details: while MacNQC is the friendly GUI application, but uses the older version 2.5r1 of the core compiler. The latest version (3.1r4) is available for OSX, but in command-line flavor only. Also, the new LEGO Mindstorms NXT officially supports OSX, through the magic of LabVIEW, no less!

The picture on top shows the Mushi Mushi 7 by Jin Sato.

2 Comments:

At 5:18 PM, Anonymous Anonymous said...

Intersting article, thanks.

Have you done any work with swipe card readers on Mac Os X ? http://stripesnoop.sourceforge.net/

 
At 6:32 PM, Blogger Roberto said...

Nope. No experience with swipe readers. Sorry.

 

Post a Comment

<< Home