I'd also like to read the data, too. In Swift it's easy, but is there an easy way to do this in a sketch?
// Swift 3 code...
let manufacturerName = NSString(data: characteristic.value!, encoding: String.Encoding.utf8.rawValue)
// Arduino Sketch...
if (myStringChar.written() {
myString = another_magical_encoding_function(myStringChar.value())
Appreciate any help.
PS: I saw a similar post here, but I don't have an android device, so I can't use the App and see what this would look like.
Can someone post the steps please?
This is a bit of tricky topic, at least it was for me when I first started exploring BLE last year. All BLE data is sent as bytes. So you will have to translate the bytes you send at both ends of the communication.
One technique I learned how to use on the arduino sketch end is the union which allows you to share a memory location between two different data types. You can read about how this helped me handle a stream of floats here:
You should also consider getting the book
Make: Bluetooth by Allan, Coleman and Mistry great projects, tips and advice for working with BLE on Arduino. It is the best book on BLE for the maker crowd.
Sorry for the late reply. I'm still new to using the forms and didn't how to get to my messages.
I saw the topic you're referring to. Unfortunately, I don't have an Android device to load and run the app with.
And yes, I saw your imu-to-you. That's what got me started on all this
I'm definitely going to use your approach. Plus I'm want to send quaternion float data (x, y, z, m) and will try to do a union with that (only I don't know how read it back in Swift/iOS - but I'll work on it).
I picked up the Bluetooth book per your recommendation, too.
Been going through it, but all the 'functions' seem to be high level for js, android, and other languages.
I really thought there would be a 'stringToBytes' type of function in c (for .ino sketches) to turn a string into a bytes or visa-versa that can be sent over BLE communications.
Anyway, the search continues.
Once I find a working solution, I'll post it for all to see.