コード例 #1
0
ファイル: MeadowApp.cs プロジェクト: csuski/Meadow.Foundation
        private void TestGY521()
        {
            Console.WriteLine("TestGY521...");

            // Wake
            gY521.Wake();

            while (true)
            {
                Console.WriteLine("Reading...");
                gY521.Refresh();

                Console.WriteLine($" ({gY521.AccelerationX:X4},{gY521.AccelerationY:X4},{gY521.AccelerationZ:X4}) ({gY521.GyroX:X4},{gY521.GyroY:X4},{gY521.GyroZ:X4}) {gY521.Temperature}");

                Thread.Sleep(2000);
            }
        }
コード例 #2
0
        private void GY521Test(II2cBus i2c)
        {
            Console.WriteLine("+GY521 Test");

            var gyro = new GY521(i2c);

            Console.WriteLine(" Wake");
            gyro.Wake();

            while (true)
            {
                Console.WriteLine(" Reading...");
                gyro.Refresh();

                Console.WriteLine($" ({gyro.AccelerationX:X4},{gyro.AccelerationY:X4},{gyro.AccelerationZ:X4}) ({gyro.GyroX:X4},{gyro.GyroY:X4},{gyro.GyroZ:X4}) {gyro.Temperature}");

                Thread.Sleep(2000);
            }
        }