For those of you who don't know, I am currently doing a project at the University of Washington dealing with RCX communication. I need to be able to send an opcode from one RCX with lejos firmware to another RCX with any given firmware (most likely legOS or default firmware). This opcode will tell the other RCX to delete firmware, play a sound, move a motor, etc.
There are two classes I've seen in the Lejos API, LLC.class (low level comms) and serial.class.
Which one should I use, or will both work? I am currently programming with the serial class, but I have not tested it yet to see if another RCX can receive the message I am sending. Most of my knowledge is based off of the RCX Internals website, but any help would be greatly appreciated!
Here is the comms part of the code so far...
public static final byte OPCODE_DELETE_FIRMWARE = (byte)0x65;
protected void sendByte()
byte packet = new byte;
// pack the bits
packet = (byte)0x55;
packet = (byte)0xFF;
packet = (byte)0x00;
packet = (byte)0xF7;
packet = (byte)0x08;
packet = (byte)OPCODE_DELETE_FIRMWARE;
packet = (byte)0x1A;
packet = (byte)0xFA;
packet = (byte)0x05;
josx.platform.rcx.Serial.sendPacket(packet, 0, 9);
According to the RCX Internals website, I know you need to send the opcode header 55 FF 00, then the message, than the checksum.
University of Washington
P.S. Sorry for the big post!