Separating before and after values of decimal string

Hi, i am using HC-05 Bluetooth module to send my data from joystick to the servo motors. I am using String to send the value of joystick. The values before decimal are the value of X-axis and the value after decimal are the value of Y-axis. The transmission and receiving part is going good but I am unable to extract the values so that I can rotate my both servos.
I am attaching my codes here , let me know how I can do so. Should I convert the string values of receiver to long or into, if so then how I can do that??

Bluetooth_Master.ino (631 Bytes)
bluetooth_receive.ino (503 Bytes)

If you insist on using Strings then take a look at the indexOf() and substring() functions of the String library

Thanks for the reply , it is solved now.

Give a numerical example of data like 123.567 that you are sending from Master to Slave. Assume that you are sending 123.567, then are you sending the individual symbols (1, 2, 3, ., 5, 6, 7) in their respective ASCII codes or you are doing the BINary transmission; where, 123.456 is transmitted as 42F7224E (called binary32 format)?

1 Like

Note the use of Strings

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.