Celluar Phone Problem Again :(

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

Moderators: 99jonathan, roger, imaqine

Celluar Phone Problem Again :(

Postby Hattusas » Mon Dec 03, 2007 12:08 pm

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?

Any suggestions???
Today is the first day of rest of your life.
Hattusas
New User
 
Posts: 12
Joined: Sat Oct 06, 2007 11:24 am

Postby lawrie » Mon Dec 03, 2007 9:40 pm

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.
lawrie
leJOS Team Member
 
Posts: 919
Joined: Mon Feb 05, 2007 1:27 pm


Return to NXJ Software

Who is online

Users browsing this forum: Google [Bot] and 3 guests

more stuff