lejos-nxj

How do I set up a Java-like language (LeJOS NXJ) in Visual Studio 2005 that uses an external compiler?

Recently, I installed the JDK and a java library called LeJOS NXJ, for controlling a LEGO Mindstorms robot. I'd like to be able to set up the language to run through visual studio, which offers J# color coding. The command line to compile the program is: nxjc "Myfile.java" and the command line to deploy or download the program to the ...

How can I interrupt a sequence of procedures in Java?

I have a bunch of procedures that need to be executed successively until either they are all executed, or a certain condition is met. Here's the basic code that needs to be executed until a condition is met: public boolean search() { robot.go(); robot.spin(); //etc - around 8 more similar commands (each takes around 2 seco...

What is the difference between the Lego Mindstorms 1.0 and 2.0

I am thinking about buying a mindstorms kit (I don't currently own one but I have used 1.0 at university) and I am a bit unsure as to the benefits of 2.0 over 1.0. I have seen other posts on the subject all saying generally 2.0 is better but I have some more specific questions about this that I can't seem to find any answers on. Apart f...

Lejos Behavior Does Not Run Multiple Times

We are trying to implement two behaviors on a rcx robot, the lowest priority given to a touch sensor, and the hightest given to a light sensor for a sumobot competition. However, the behaviors cannot run simultaneously. For example, the action for the touch sensor will not occur twice in a row. Instead each action of the behaviors mus...

Is this valid Java code?

I'm using Eclipse, and it is perfectly happy with the following code: public interface MessageType { public static final byte KICK = 0x01; public static final byte US_PING = 0x02; public static final byte GOAL_POS = 0x04; public static final byte SHUTDOWN = 0x08; public static final byte[] MESSAGES = new...

Is it standard behavior for this code to throw a NullPointerException?

I've had a big problem in some library code, which I've pinned down to a single statement: System.out.println((String) null); Ok, the code doesn't actually look like that, but it certainly calls println with a null argument. Doing this causes my whole applicaio to throw an unexpected NullPointerException. In general, should println t...

Linking Problem: Uploading Program To Robot Using leJOS

Hi Guys, I am trying to compile and upload my program to the robot but i am getting linking errors that my .class file is not found in the class path. This is my .bat file: @echo off f: cd "F:\Program Files\eclipse\workspace\src\testRobot" call nxjc *.java call nxj -d 001653081321 -b RobotReceiverMainAPP After i run it i get ...

Need Help Reading Data From Inputstream

Hi Guys, I have a robot and a GUI application running on a GUI. I have a while loop on the robot side that is constantly sending data to the GUI. Before i send a value, i send first a value which the GUI will use to determine how many consecutive values it must read afterwards for instance i send something like; dataout.writeInt(2); d...

Need Help And Ideas In Solving A Collection Problem

Hi Guys, I have already posted a question today. This question is about the same project but unrelated. I am developing an application for the Lego NXT Mindstorm robot. I have two robots and a GUI running on a PC. In leJOS NXJ you can only use one input reader. This means that you can't connect the PC to two robots directly and let th...

Need Help Again Reading Data From Inputstream

Hi Guys, Yesterday i posted a question about a problem i had concerning inputstream reading and i was helped. I find myself in similar situation but this time i know that I am doing the right thing but yet it is not working for me. I am reading from an inputstream but i get different value. No matter how i change the data i send i get...

Lejos RGB color sensor

Does anyone have a code example of using the NXT RGB Color Sensor in the Lejos programming language. I have tried several different uses of setType() and setMode() but to no avail. ...