Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reading Floats being sent by the RFduino #5

Open
saadbutt67 opened this issue Feb 19, 2015 · 10 comments
Open

Reading Floats being sent by the RFduino #5

saadbutt67 opened this issue Feb 19, 2015 · 10 comments

Comments

@saadbutt67
Copy link

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

@madCode
Copy link

madCode commented Apr 23, 2015

I am also having this issue.

@saadbutt67
Copy link
Author

@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

@madCode
Copy link

madCode commented Jun 25, 2015

This worked! Thank you :)

@tmsio
Copy link

tmsio commented Dec 12, 2015

Hi, if i have to send 2 float?
This is my code:
RFduinoBLE.sendFloat(a);
RFduinoBLE.sendFloat(b);

Thank You.

@angel545
Copy link

angel545 commented Mar 5, 2016

@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

@saadbutt67
Copy link
Author

@angel545 are you using eclipse or android studio

@angel545
Copy link

angel545 commented Mar 5, 2016

@saadbutt67 I am using android studio. I wonder is it possible that you can send me the modified apk file straight? thanks

@angel545
Copy link

angel545 commented Mar 5, 2016

@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
#5 (comment).

@saadbutt67
Copy link
Author

@angel545
Find this line in the code

addData(intent.getByteArrayExtra(RFduinoService.EXTRA_DATA));

This is where you're receiving data

@saadbutt67
Copy link
Author

Replace this line of code with the one i commented earlier

For multiple float values do a loop

Hope this helps

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants