// Update is called once per frame void Update () { if (!streaming && SpheroProvider.GetSharedProvider().GetConnectedSpheros().Length > 0) { // Setup streaming for the first time once a Sphero is connected. //// Register the event handler call back with the SpheroDeviceMessenger SpheroDeviceMessenger.SharedInstance.AsyncDataReceived += ReceiveAsyncMessage; //// Get the currently connected Sphero Sphero[] spheros = SpheroProvider.GetSharedProvider().GetConnectedSpheros(); m_Sphero = spheros[0]; //// Enable data streaming for controller app. This method turns off stabilization (disables the wheel motors), //// turn on the back LED (negative x axis reference), and sets data streaming at 20 samples/sec (400/20), //// a single sample per packet sent, and turns on accelerometer, quaternion, and IMU (attitude) sampling. m_Sphero.EnableControllerStreaming(20, 1, SpheroDataStreamingMask.AccelerometerFilteredAll | SpheroDataStreamingMask.QuaternionAll | SpheroDataStreamingMask.IMUAnglesFilteredAll); streaming = true; } }
// Update is called once per frame void Update() { if (!streaming && SpheroProvider.GetSharedProvider().GetConnectedSpheros().Length > 0) { // Setup streaming for the first time once a Sphero is connected. //// Register the event handler call back with the SpheroDeviceMessenger SpheroDeviceMessenger.SharedInstance.AsyncDataReceived += ReceiveAsyncMessage; //// Get the currently connected Sphero Sphero[] spheros = SpheroProvider.GetSharedProvider().GetConnectedSpheros(); m_Sphero = spheros[0]; //// Enable data streaming for controller app. This method turns off stabilization (disables the wheel motors), //// turn on the back LED (negative x axis reference), and sets data streaming at 20 samples/sec (400/20), //// a single sample per packet sent, and turns on accelerometer, quaternion, and IMU (attitude) sampling. m_Sphero.EnableControllerStreaming(20, 1, SpheroDataStreamingMask.AccelerometerFilteredAll | SpheroDataStreamingMask.QuaternionAll | SpheroDataStreamingMask.IMUAnglesFilteredAll); streaming = true; } }