User Tools

Site Tools


linux:legomindstorms

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
linux:legomindstorms [2013/12/31 20:44] rlunarolinux:legomindstorms [2014/01/07 23:46] rlunaro
Line 145: Line 145:
  
  
 +==== My first program ====
  
- 
- 
- 
- 
-So I'm afraid further investigation is needed. 
- 
-**Last try** 
  
 I've attached a motor to the "C" square of the RCX: I've attached a motor to the "C" square of the RCX:
Line 160: Line 154:
 And this is my first program:  And this is my first program: 
  
-<code nqc>+<code c>
 task main() task main()
 { {
Line 173: Line 167:
 </code> </code>
  
-When I try to run it, I get the following error:  
- 
-<code shell> 
-$ nqc -S/dev/ttyUSB0 -run Hello.nqc  
-No firmware installed on RCX 
- 
-</code> 
- 
-So, I definitely think that the RCX is completely blank, and I have to install some sort of firmware to have it properly working.  
- 
---------- 
- 
-==== Executing the program ==== 
  
 To run and download the program into the RCX, you should do the following: To run and download the program into the RCX, you should do the following:
Line 200: Line 181:
  
 ===== Second Attempt: LEJOS ===== ===== Second Attempt: LEJOS =====
 +
 +==== Install ant ====
 +
 +You should have ''ant'' installed. To do so, 
 +
 +<code shell>
 +$ sudo apt-get install ant
 +</code>
 +
 +And should have ''libusb-dev'' installed also. 
 +
 +<code shell>
 +sudo apt-get install libusb-dev
 +</code>
 +
 +After doing that, make sure that the usb.h file is available in your destination system. 
 +
 +
 +==== Hands on ====
  
 [[http://www.lejos.org/|Lejos]] is a Java Virtual Machine for the RCX (the yellow box). It's a replacement for the Lego firmware, so, if your CD of mindstorms is broken, it's the perfect solution. [[http://www.lejos.org/|Lejos]] is a Java Virtual Machine for the RCX (the yellow box). It's a replacement for the Lego firmware, so, if your CD of mindstorms is broken, it's the perfect solution.
  
 The web page has a [[http://www.lejos.org/rcx/tutorial/index.html|fantastic tutorial]] that shows the steps to be taken to have this stuff running.  The web page has a [[http://www.lejos.org/rcx/tutorial/index.html|fantastic tutorial]] that shows the steps to be taken to have this stuff running. 
 +
 +When I've checked out the web page, the download link didn't work. But you can go directly to the [[http://sourceforge.net/projects/lejos|sourceforge webpage]] in order to download the files. 
 +
 +When you download and uncompress the file ''leJOS_NXJ_0.9.1beta-3.tar.gz'', you should check out the README.html file. 
 +
 +Then start by setting the environment variable NXJ_HOME: 
 +
 +<code shell>
 +$ cd LEJOS_NXJ_DIRECTORY   # the files ACKNOWLEDGMENTS.txt, LICENSE.txt, RELEASENOTES.txt should be there
 +$ NXJ_HOME=$(pwd)
 +$ export NXJ_HOME
 +</code>
 +
 +Then go to the ''build'' directory and run ''ant''. This is for construct the USB support for java. 
 +
 +In my case, this command failed. The problem was in the ''build.xml'' file located in NXJ_HOME/build/libnxt. I've reconstructed the compiler command: 
 +
 +<code shell>
 +gcc -Wall -std=gnu99 -fPIC main_jlibnxt.c
 +</code>
 +
 +
 +And it fails with this error: 
 +
 +<code>
 +main_jlibnxt.c:28:17: fatal error: usb.h: No such file or directory
 +</code> 
 +
 +**Solution:**
 +
 +    - Locate the usb.h file in your filesystem: ''find / -iname usb.h 2>/dev/null'': in my system this appears in ''/usr/include/usb.h''
 +
 +I've fixed the solution executing the ''make'' command and then:
 +
 +<code shell>
 +$ cd NXJ_HOME/build
 +$ ant
 +</code>
 +
 +
 +
  
  
linux/legomindstorms.txt · Last modified: 2022/12/02 22:02 by 127.0.0.1