Arduino Function: NaxisMotion.resetInterrupt


This function is used to reset the interrupt line


void resetInterrupt(void)


//Contains the bridge code between the API and the Arduino Environment
#include "NAxisMotion.h"
#include <Wire.h>

//Object that for the sensor
NAxisMotion mySensor;

//To store the last streamed time stamp
unsigned long lastStreamTime = 0;

//To stream at 25Hz without using additional timers (time period(ms) =1000/frequency(Hz))
const int streamPeriod = 40;

//Flag to update the sensor data. Default is true to perform the first read before the first stream
bool updateSensorData = true;

void setup() { //This code is executed once
//Peripheral Initialization
//Initialize the Serial Port to view information on the Serial Monitor

//Initialize I2C communication to the let the library communicate with the sensor.
//The I2C Address can be changed here inside this function in the library

/* Sensor Initialization */
//Can be configured to other operation modes as desired

//The default is AUTO. Changing to manual requires calling the relevant update functions prior to calling the read functions

//Setting to MANUAL requires lesser reads to the sensor

attachInterrupt(INT_PIN, motionISR, RISING); //Attach the interrupt to the Interrupt Service Routine for a Rising Edge. Change the interrupt pin depending on the board

//Setup the initial interrupt to trigger at No Motion
mySensor.enableSlowNoMotion(threshold, duration, NO_MOTION);
anyMotion = false;
mySensor.accelInterrupts(ENABLE, ENABLE, ENABLE); //Accelerometer interrupts can be triggered from all 3 axes

Serial.println("This is a game to test how steady you can move an object with one hand. \nKeep the device on a table and mark 2 points.");
Serial.println("Move the Device from one place to another without triggering the Any Motion Interrupt.\n\n");
delay(1000); //Delay for the player(s) to read
Serial.println("Move the device around and then place it at one position.\nChange the threshold and duration to increase the difficulty level.");
Serial.println("Have fun!\n\n");

void loop() { //This code is looped forever
if (intDetected) {
if (anyMotion) {
Serial.println("You moved!! Try again. Keep the Device at one place.\n");
intDetected = false;
mySensor.resetInterrupt(); //Reset the interrupt line
mySensor.disableAnyMotion(); //Disable the Any motion interrupt
mySensor.enableSlowNoMotion(threshold, duration, NO_MOTION); //Enable the No motion interrupt (can also use the Slow motion instead)
anyMotion = false;
} else {
Serial.println("Device is not moving. You may start again.\n\n\n");
intDetected = false;
mySensor.resetInterrupt(); //Reset the interrupt line
mySensor.disableSlowNoMotion(); //Disable the Slow or No motion interrupt
mySensor.enableAnyMotion(threshold, duration); //Enable the Any motion interrupt
anyMotion = true;

//Interrupt Service Routine when the sensor triggers an Interrupt
void motionISR() {
intDetected = true;

Based on the reference originally written by Arduino Community, and