Hello everyone. As you may remember from my previous post, I have been dealing with remote commanding of NXT via phone (Ericsson & Nokia both are working.)
The program in my NXT waits for bluetooth connection and after the connection has established it opens the DataInput and OutputStreams to receive commands.
When the simples such as 2,4,5,8 etc. the robot turns right,left, goes forward & backward.
The remote program requests a connection and sends the commands from a GUI (Applet in PC, MIDLET in my cell phone) via OutputStreams.
The applet works nicely.But from the point of the MIDLET I am afraid I can't say so.
In my MIDLET the BT Connection is established ( NXT also confirms that a BT connection is made) and the display substitudes to a GAME CANVAS where I can listen the keys.
When I press the keys the listener methods works all right and sends a simple integer 2,4,5,6 so on.
BUT in the LCD of NXT the numbers are so odd! 453654? -5463? 643543?
I can't make head or tail of it!
When My applet running on my PC sends an integer lets say 5. NXT shows 5 as well?
This is where you talk about the NXJ software itself, installation issues, and programming talk.
2 posts • Page 1 of 1
Like the standard Lego firmware leJOS currently sends 2-byte length headers with every packet. The pccomm implementation of OutputStream adds these headers. It you use the Bluetooth API streams from a midlet, you will have to add these headers yourself. If you are sending single byte commands send (byte) 1, (byte) 0 and then the command byte. the header is in LSB, MSB byte order but MSB must be zero.
Who is online
Users browsing this forum: No registered users and 1 guest