Read unit8 bytes to data
I want to convert the unit8 bytes array into meaningful data. For example, if I connect to the metawear motion r board, and read the gyroscope and accelerometer, I see this:
// gyroscope
[19, 5, 165, 0, 70, 0, 99, 0]
// accelerometer
[3, 4, 63, 0, 174, 254, 252, 222]
From looking at the tutorials around the net, I can tell that the pairs represent axis. In the gyroscope example, here is what I think is correct:
[165 0] - x axis gyro raw
[70 0] - y axis gyro raw
[99 0] - z axis gyro raw
How can I convert the unit8 bytes into a float representation of the sensor values ( both for accelerometer and gyroscope streams ) ? ( A Swift or Java code example would help substantially here )
Comments
For swift, you can check how we parse data by looking at the "doTheParse" function: https://github.com/mbientlab/MetaWear-SDK-iOS-macOS-tvOS/blob/master/MetaWear/Core/MetaWearData.swift
I've looked at this code snippet, but it does not mention how the bytes are to be arranged and read. Can you share a different code snippet?
Ok, I've looked at this code : https://github.com/mbientlab/MetaWear-SDK-Cpp/blob/master/src/metawear/impl/cpp/datainterpreter.cpp , and solved my problem.
awesome!