Hi @rickkas7,
cheers for updating the library. One thing that I could not comprehend is turning GPS on/off while using sleep() with accel wakeup. Specifically this code segment
Serial.println("Turning GPS off");
//Is this necessary?
digitalWrite(D6, HIGH);
pinMode(D6, INPUT);
// Sleep
delay(500);
System.sleep(WKP, RISING, TIME_PUBLISH_BATTERY_SEC);
delay(500);
awake = ((t.clearAccelInterrupt() & LIS3DH::INT1_SRC_IA) != 0);
Serial.printlnf("awake=%d", awake);
// Restart the GPS
pinMode(D6, OUTPUT);
digitalWrite(D6, LOW);
Now if I comment both
//digitalWrite(D6, HIGH);
//pinMode(D6, INPUT);
GPS wouldn’t turn off before device goes to sleep and remains turned on during the sleep
If I do
digitalWrite(D6, HIGH);
//pinMode(D6, INPUT);
GPS turns off before sleep but then device never wakes up (somehow it alters accel behavior I am not sure why)
If I do
digitalWrite(D6, HIGH);
pinMode(D6, INPUT);
GPS turns off before sleep, remain off during sleep and turns on at wake up. accel also wakes up reliably for this setting. So this code is working 100% as I want it to. The problem now is that I don’t understand why we need to set D6 as input? Why just setting D6 to HIGH doesn’t work?
Thanks