RCX communication

This is where you talk about the RCX software itself, installation issues, and programming talk.

Moderator: roger

New User
Posts: 13
Joined: Mon Jan 22, 2007 3:29 am
Location: Australia

RCX communication

Postby umeshnk » Tue Feb 20, 2007 7:46 am

Can we send multiple data using sendPacket(byte[] packet,int offset,int length) method. For example x,y coordinates in the same packet. Please somebody explain what is meant by offset and lenght given in this method..

New User
Posts: 6
Joined: Tue Feb 20, 2007 7:35 pm
Location: London

Postby theinevitable » Wed Feb 21, 2007 9:01 am

Yes you can send multiple data in a single packet. The packet you are sending in the first argument is an array, of which size you define with the length argument. Offset just defines where you want to start reading the array. In most cases you would keep offset to zero.

Code: Select all

byte [] packet = new byte[3];

packet[0] = (byte) 0xf7;
packet[1] = (byte) x;
packet[2] = (byte) y;

So when you recieve the package on the reciever, you will access element 1 for x and element 2 for y.

Return to “RCX Software”

Who is online

Users browsing this forum: No registered users and 0 guests