RFDuinoTest
RFDuinoTest copied to clipboard
Reading Floats being sent by the RFduino
Hi @lann , I have been using your test project but i am facing an issue. I cant figure out how to read float values being sent by the RFduino to the android application. I have tried Floatbuffer, float.parse string, even the HEX helper but all in vain . From what i understand your code gives us a way to get the recieved data (initially in the form of bytes) in the form of a string or convert it into HEX values. but it would be extremely helpfull if you can let me know how to solve this problem
I am also having this issue.
@madCode first of all use RFduinoBLE.sendFloat() to send a float value [reffer to this guide for help on that http://files.rfdigital.com/rfduino.ble.programming.reference.pdf]
second use this code in android for receiving byte[] ff = intent.getByteArrayExtra(RFduinoService.EXTRA_DATA); float f = ByteBuffer.wrap(ff).order(ByteOrder.LITTLE_ENDIAN).getFloat(); this will be extremely slow in case you are sending lots of values hope this solves the issue
This worked! Thank you :)
Hi, if i have to send 2 float? This is my code: RFduinoBLE.sendFloat(a); RFduinoBLE.sendFloat(b);
Thank You.
@saadbutt67 hey, I facing the same problem but I have no clue how to change the source code of the apk. Possible to help me with it? thanks
@angel545 are you using eclipse or android studio
@saadbutt67 I am using android studio. I wonder is it possible that you can send me the modified apk file straight? thanks
@saadbutt67 I tried a few times to compile the apk file again after changing the code but it still doesnt work. May I knw in which part of the code you add in that two lines of code? thanks
— Reply to this email directly or view it on GitHub https://github.com/lann/RFDuinoTest/issues/5#issuecomment-192576987.
@angel545 Find this line in the code
addData(intent.getByteArrayExtra(RFduinoService.EXTRA_DATA));
This is where you're receiving data
Replace this line of code with the one i commented earlier
For multiple float values do a loop
Hope this helps