Re: Android Bluetooth Remote Control
I've been deep into this kind of thing lately and I can probably help you out. One thing I finally realized, that with some effort, I did not need to go the string to number conversion route, however it can and should work.
Can you post the code snippet of how the data is transmitted? I will have to look at app inventor a bit to see what its doing, but I believe I can find that myself. Are you using any sort of pre-written library (for NXT or Bluetooth) on the android side of it?
I don't know if you saw it, but I recently also did an android to nxt project. it used LCP commands to transmit motor power based on the gyroscope. Have a look to see if it helps any; http://www.spiked3.com/?p=253
The portion that does the bluetooth was unmodified from a LEGO supplied application, and the source is included in the files.
update: OK - i looked at app inventor a little, that's kind of nice. Unfortunately for me, I just uninstalled java a little earlier today, so I can not really run it fully. it appears that it is using standard nxt messaging though.
In my code, I do the read a little differently;
I'm wondering if in your code data[i], is causing a problem? in C with pointers, I might expect either to work, but in RobotC I've found to expect the unexpected. I'm pretty sure you also do not need to loop for the message size, one read and you should have it.
simply point atoi to the read message and it should be good.
so your code may end up looking like
try that and let us know if it works.