Beispiel #1
0
        // default at power-up:
        //    Gyro at 250 degrees second
        //    Acceleration at 2g
        //    Clock source at internal 8MHz
        //    The device is in sleep mode.
        //
        //Accelerator with +/-2g range = 16384 LSB/g. So a value of 16384 is 1 g.
        //Get the accelerator value during setup(), and save it in rawOffset.
        //In the loop() get the value and calculate the 'g' value:
        public static void Main()
        {
            Debug.EnableGCMessages(true);

            WhoAmI();

            DisableSleepMode();

            Thread.Sleep(1000);

            ArrayList calibrationMeasurements = new ArrayList();
            GetMeasurementsForCalibration(calibrationMeasurements);

            MPU6050 measurement = new MPU6050(calibrationMeasurements);

            while (true)
            {
                var bytes = GetMpuRawData();
                measurement.Update(bytes);
                Thread.Sleep(1);
                measurement.PrintAngles();
            }
        }
Beispiel #2
0
        // default at power-up:
        //    Gyro at 250 degrees second
        //    Acceleration at 2g
        //    Clock source at internal 8MHz
        //    The device is in sleep mode.
        //

        //Accelerator with +/-2g range = 16384 LSB/g. So a value of 16384 is 1 g.
        //Get the accelerator value during setup(), and save it in rawOffset.
        //In the loop() get the value and calculate the 'g' value:
        public static void Main()
        {
            Debug.EnableGCMessages(true);

            WhoAmI();

            DisableSleepMode();

            Thread.Sleep(1000);

            ArrayList calibrationMeasurements = new ArrayList();

            GetMeasurementsForCalibration(calibrationMeasurements);

            MPU6050 measurement = new MPU6050(calibrationMeasurements);

            while (true)
            {
                var bytes = GetMpuRawData();
                measurement.Update(bytes);
                Thread.Sleep(1);
                measurement.PrintAngles();
            }
        }