Running Lejos on RCX 2.0 and Mac OSX Snow Leopard
Yesterday I purchased a Lego Mindstorms NXT 2.0 for my son.
It was ridiculously expensive. I had a focus on robotics in my BS program, so I was excited to build some robots with him. At the time, we used the Lego Robotics Invention System (now called RCX). I went onto craigslist and found one of these machines so that I could build robots with my son, but without the $300+ pricetag.
After procuring the machine, I spent some time trying to setup the development environment I had used back in college. Unfortunately, the C toolchain I had used was not available for Mac (at least, I couldn’t find a tutorial on setting it up.) I found an interesting firmware replacement at lejos.org that allows you to code your applications in java, using a custom library set.
Being a Java developer by day, this appealed to me quite a bit. So I set about the long process of trying to get lejos to work on my 64-bit Snow Leopard MBP… and failed miserably. There were compilation issues (conversion of 64-bit pointers to 32-bit handles in the code necessary to communicate with the IR tower (used to program the RCX).
Finally, I found http://lejos.sourceforge.net/forum/viewtopic.php?f=10&t=1673, and the link by tsinn where he’d setup an installer for the lejos subsystem and toolchain onto Mac OSX 10.5 (a 32-bit system). After downloading his system, then making a couple of tweaks, I was able to generate the following package: http://kennelbound.com/downloads/lejos3.zip
To use, simply do the following:
1) Download and extract the lejos3,zip to a local folder (such as /personal/lejos3)
2) Edit the lejos.env file and change the LEJOS_HOME to point to the directory where you extracted it.
3) Open a command console, and cd to the LEJOS_HOME directory
4) Type in “source lejos.env” (without the quotes)
5) cd to the LEJOS_HOME/bin directory
6) Install the firmware onto the RCX using “./firmdl” without the quotes
7) You should see some progress. Once it completes, you now have the RCX running lejos!
You can test it with a simple Hello World application:
1) cd to lejos3/examples/test/hworld
2) execute “lejosjc HelloWorld; lejos HelloWorld” without the quotes to compile and send the program to the RCX.
3) Once it’s done, on the RCX, press the “Run” button.
You should see “hello world” on the RCX’s LCD.
Next time, I’ll write down how I have Intellij setup so that I can run and load the applications with ease!
| Print article | This entry was posted by admin on March 27, 2011 at 3:12 pm, and is filed under Development, Java, Tools. Follow any responses to this post through RSS 2.0. You can skip to the end and leave a response. Pinging is currently not allowed. |