Skip to content

Can not receive the message from unit #1

@GIRAFFE-YIN

Description

@GIRAFFE-YIN

Hi,
I'm working on transmitting data from ESP32 to unity, thanks for providing this useful example.
I slightly modify your program so It is almost the same and I thought it won't be any problems. But when unity goes to subscribes stage.

`case States.Subscribe:
BluetoothLEHardwareInterface.SubscribeCharacteristicWithDeviceAddress(_deviceAddress, ServiceUUID, SubscribeCharacteristic, null, (address, characteristicUUID, bytes) => {

                // we don't have a great way to set the state other than waiting until we actually got
                // some data back. For this demo with the rfduino that means pressing the button
                // on the rfduino at least once before the GUI will update.
                _state = States.None;

                // we received some data from the device
                _dataBytes = bytes;
                float qx = System.BitConverter.ToSingle(bytes, 0);
                float qy = System.BitConverter.ToSingle(bytes, 8);
                float qz = System.BitConverter.ToSingle(bytes, 4);
                float qw = System.BitConverter.ToSingle(bytes, 12)*-1;

                rawQuat = new Quaternion(qx, qy, qz, qw);
                cubeTransform.rotation = quatLookAtCam*rawQuat;

                //DeviceNameFoundedText.text = qx.ToString() + " " + qy.ToString() + " " + qz.ToString() + " " + qw.ToString()+"\n";
                DeviceNameFoundedText.text = "raw : "+rawQuat.ToString()+"\n";
                DeviceNameFoundedText.text += "cube : "+cubeTransform.rotation.ToString();

            });
            break;`

everything in side seems did nothing T_T.
and the console shows:
截屏2020-03-26下午8 23 36

Did you met this problem before?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions