Exemplo n.º 1
0
        /// <summary>
        /// Checks the tilt state. Tilt is being detected when acceleration is > 0.688g or X/Y axis > 45°.
        /// </summary>
        /// <param name="state">True if tilt detected. False if not.</param>
        private void TiltCheck(object state)
        {
            mma8491qEn.Write(GpioPinValue.High);
            Task.Delay(1).Wait();
            bool tiltState = mma8491qInt.Read() == GpioPinValue.Low ? true : false;

            mma8491qEn.Write(GpioPinValue.Low);

            if (prevTiltState != tiltState)
            {
                prevTiltState = tiltState;
                MMA8491QTiltEventArgs ea = new MMA8491QTiltEventArgs(tiltState);
                OnMMA8491QTiltChange(ea);
            }
        }
Exemplo n.º 2
0
 protected virtual void OnMMA8491QTiltChange(MMA8491QTiltEventArgs e)
 {
     TiltChanged?.Invoke(this, e);
 }