You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: examples/Arduino/Example4_WakeOnMotion/Example4_WakeOnMotion.ino
+8-4Lines changed: 8 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -42,15 +42,16 @@
42
42
volatilebool isrFired = false;
43
43
volatilebool sensorSleep = false;
44
44
volatilebool canToggle = false;
45
-
unsignedint WOM_threshold=200;
45
+
unsignedint WOM_threshold=255;
46
+
double lastTrigerred;
46
47
47
48
voidsetup() {
48
49
49
50
pinMode(INT_PIN, INPUT_PULLUP); // Using a pullup b/c ICM-20948 Breakout board has an onboard pullup as well and we don't want them to compete
50
51
attachInterrupt(digitalPinToInterrupt(INT_PIN), icmISR, FALLING); // Set up a falling interrupt
51
52
52
53
pinMode(LED_PIN, OUTPUT);
53
-
digitalWrite(LED_PIN, !sensorSleep);
54
+
digitalWrite(LED_PIN, LOW);
54
55
55
56
SERIAL_PORT.begin(115200);
56
57
while(!SERIAL_PORT){};
@@ -215,7 +216,9 @@ void loop() {
215
216
isrFired = false;
216
217
myICM.getAGMT(); // get the A, G, M, and T readings
217
218
// printScaledAGMT( myICM.agmt); // This function takes into account the sclae settings from when the measurement was made to calculate the values with units
218
-
SERIAL_PORT.println(F("Shock detected"));
219
+
SERIAL_PORT.println(F("Shock detected"));
220
+
digitalWrite(LED_PIN, HIGH);
221
+
lastTrigerred=millis();
219
222
delay(30);
220
223
myICM.clearInterrupts(); // This would be efficient... but not compatible with Uno
221
224
}
@@ -231,7 +234,8 @@ void loop() {
231
234
// 2. use the pulse-based interrupt in ICM settings (set cfgIntLatch to false)
232
235
// 3. use a microcontroller with nestable interrupts
0 commit comments