Exemplo n.º 1
0
        public PWM_AIO_Demo_Main()
        {
            //AIO pin connected to arbitrary range potentiometer.
            AnalogInput pot = new AnalogInput(AnalogChannels.ANALOG_PIN_A0);

            pot.Scale = 1; //sets range value that is returned by aio read()


            //Initialize I2C interface for HD44780 LCD.
            // Disabled while tinkering with MPU6050
            //LCD_Display Display = new LCD_Display(LCD_I2C_ADDRESS, 20, 4);

            IMU_I2C imu = new IMU_I2C(IMU_I2C.MPU6050_DEFAULT_ADDRESS);

            SensorData imuData = imu.getSensorData();

            bool       onboardstate = false;
            OutputPort onboardled   = new OutputPort(Pins.ONBOARD_LED, onboardstate);

            while (true)
            {
                Thread.Sleep(1);
                imuData      = imu.getSensorData();
                onboardstate = !onboardstate;
                onboardled.Write(onboardstate);

                Debug.Print("X Y Z X' Y' Z' " + imuData.Gyroscope_X.ToString() + " " + imuData.Gyroscope_Y.ToString() + " " + imuData.Gyroscope_Z.ToString() + " " + imuData.Acceleration_X.ToString() + " " + imuData.Acceleration_Y.ToString() + " " + imuData.Acceleration_Z.ToString());
            }
        }
Exemplo n.º 2
0
        public PWM_AIO_Demo_Main()
        {
            //AIO pin connected to arbitrary range potentiometer.
            AnalogInput pot = new AnalogInput(AnalogChannels.ANALOG_PIN_A0);
            pot.Scale = 1; //sets range value that is returned by aio read()

            //Initialize I2C interface for HD44780 LCD.
            // Disabled while tinkering with MPU6050
            //LCD_Display Display = new LCD_Display(LCD_I2C_ADDRESS, 20, 4);

            IMU_I2C imu = new IMU_I2C(IMU_I2C.MPU6050_DEFAULT_ADDRESS);

            SensorData imuData =  imu.getSensorData();

            bool onboardstate = false;
            OutputPort onboardled = new OutputPort(Pins.ONBOARD_LED, onboardstate);

            while (true)
            {
                Thread.Sleep(1);
                imuData = imu.getSensorData();
                onboardstate = !onboardstate;
                onboardled.Write(onboardstate);

                Debug.Print("X Y Z X' Y' Z' " + imuData.Gyroscope_X.ToString() + " " + imuData.Gyroscope_Y.ToString() + " " + imuData.Gyroscope_Z.ToString() + " " + imuData.Acceleration_X.ToString() + " " + imuData.Acceleration_Y.ToString() + " " + imuData.Acceleration_Z.ToString());

            }
        }