Exemplo n.º 1
0
        public static void Main()
        {
            Debug.Print("ADXL362 - Polling Sample");
            var sensor = new ADXL362(SPI_Devices.SPI1, Pins.GPIO_PIN_D7, 100);

            sensor.DisplayRegisters();
            while (true)
            {
                sensor.Update();
                Debug.Print("X: " + sensor.X + ", Y: " + sensor.Y + ", Z: " + sensor.Z);
                Thread.Sleep(1000);
            }
        }
Exemplo n.º 2
0
        public static void Main()
        {
            Debug.Print("ADXL362 - Interrupt Sample");
            var sensor = new ADXL362(SPI_Devices.SPI1, Pins.GPIO_PIN_D7, 100);

            sensor.Stop();
            sensor.ConfigureActivityThreshold(50, 10);
            sensor.AccelerationChanged += (s, e) =>
            {
                Debug.Print("Current acceleration: X = " + e.CurrentValue.X + ", Y = " + e.CurrentValue.Y + ", Z = " + e.CurrentValue.Z);
            };
            sensor.ConfigureInterrupts(ADXL362.InterruptMask.Activity, Pins.GPIO_PIN_D2);
            sensor.DisplayRegisters();
            sensor.Start();
            Thread.Sleep(Timeout.Infinite);
        }