Lynxmotion Tech Support

www.lynxmotion.com
It is currently Tue Jun 18, 2013 3:56 pm

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Java API
PostPosted: Fri Jul 20, 2012 6:53 am 
Offline
Roboteer

Joined: Wed Jun 01, 2011 5:31 am
Posts: 23
Hi all,

I am doing a Java API to connect to BAP with my pc using a bluetooth antenna. I have all the Java part done and I have tested it properly. So far I am able to send integers and strings to the robot. Floats are a bit harder. However I am a bit stuck with the basic micro code.

So far I send a number to the robot and plot it using the next fully-working code:

Code:
number var word
serin pc_in, pc_braud, [number]
serout s_out, i9600, [dec number,13]


The number has to be received with any modifier, otherwise java is not able to send it correctly. The problem comes up when I use a for... next and it never stops. Eventually, I am into an infinite loop. How can I get the decimal value of the number and stop the loop for?

Code:
index var word
for index = 0 to number
....
next


PS: As soon as i finish with the communication protocol I will update the API into the forum

Best Regards


Top
 Profile  
 
 Post subject: Re: Java API
PostPosted: Fri Oct 26, 2012 3:01 pm 
Offline
Roboteer
User avatar

Joined: Thu Aug 30, 2012 5:22 pm
Posts: 47
We are not sure to understand why you run into an infinite loop.

You are using serial communication so you need to send your floats as you would send any other string of bytes. When that are received, they should be stored in a memory location and used as floats again (if they are in the correct representation)

What representation are you using for the float? What is the for-loop used for?

Also, it might be simpler to multiply your numbers by some large enough power of 2 to remove the decimals and make it into an int, than you can process it mores easily in your embedded platform.

_________________
Carlos Asmat
Lynxmotion

Imagine it. Build it. Control it.™
http://www.Lynxmotion.com


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group