Sleep Mode for MKRNB 1500

#include <MKRNB.h>
#include <RTCZero.h>

RTCZero clock;
NB nbAccess;
NB_SMS sms;
boolean stopped = false;
boolean runningPump = false;
char * message;//
int lastrun = 0;
int lasttime = -300000;
int thistime = millis();
int hours = -1;
int minutes = -1;
int seconds = 0;
int pumpHour = -1;
int pumpMinute = -1;
int millistosec;
int wakepin = 1;
void setup() {

pinMode(4, INPUT_PULLUP); //Sanitizer float
pinMode(5, INPUT_PULLUP); //Manhole cover
pinMode(7, INPUT_PULLUP); //Manhole float
pinMode(9, OUTPUT);
pinMode(10, OUTPUT);
pinMode(11, OUTPUT);
digitalWrite(9, HIGH);
digitalWrite(10, HIGH);
digitalWrite(11, HIGH);

//UNUSED PINS ASSIGNED TO KEEP FROM FLOATING
pinMode(1, INPUT_PULLUP);
pinMode(2, INPUT_PULLDOWN);
pinMode(3, INPUT_PULLDOWN);
pinMode(8, INPUT_PULLDOWN);
pinMode(12, INPUT_PULLDOWN);
pinMode(13, INPUT_PULLDOWN);
pinMode(14, INPUT_PULLDOWN);
pinMode(6, INPUT_PULLUP);

//figure out how to save the time on power down
clock.begin();
Serial.begin(9600);
while(!Serial)
{

}
Serial.println("Manhole Sanitizer Pump Monitor Program v0.16");
bool connection = false;
while(!connection)
{
if(nbAccess.begin() == NB_READY)
{
connection = true;

}
else{
Serial.println("Attempting to connect...");
delay(1000);
}
}
delay(200);
Serial.print("Connection initialized.\n");

}

void loop() {

millistosec += millis() - thistime;
thistime = millis();
if(millistosec >= 1000)
{

millistosec %= 1000;
}

if(digitalRead(7) == LOW){
if(thistime - lasttime > 300){ // 5 minute cooldown between messages (change to min amount of time between messages in milliseconds)

Serial.println("Manhole float High Level.");
sms.beginSMS("+17068367283");// change my number here to yours
sms.print("Manhole float cutoff reached.");
sms.endSMS();
//copy and paste this section for each person you want to receive the message and change the number.
// Serial.println("Manhole float cutoff reached.");
//sms.beginSMS("+18034805561");
//sms.print("Manhole float cutoff reached.");
//sms.endSMS()
lasttime = thistime;
}

}

if(digitalRead(5) == LOW){
if(thistime - lasttime > 300){// 5 minute cooldown between messages

Serial.println("Manhole cover removed.");
sms.beginSMS("+17068367283");// change my number here to yours
sms.print("Manhole cover removed.");
sms.endSMS();
//copy and paste this section for each person you want to receive the message and change the number.
// Serial.println("Manhole float cutoff reached.");
//sms.beginSMS("+18034805561");
//sms.print("Manhole float cutoff reached.");
//sms.endSMS()
lasttime = thistime;
}
}

if(digitalRead(4) == LOW){
if(thistime - lasttime > 300){// 5 minute cooldown between messages

Serial.println("Tank out of Micro-Solve.");
sms.beginSMS("+17068367283"); //change my number here to yours
sms.print("Tank out of Micro-Solve.");
sms.endSMS();
//copy and paste this section for each person you want to receive the message and change the number.
// Serial.println("Manhole float cutoff reached.");
//sms.beginSMS("+18034805561");
//sms.print("Manhole float cutoff reached.");
//sms.endSMS()
lasttime = thistime;
}
}

}

I have a very simple program for monitoring some floats for high levels and this is in a remote area so its on batteries, I have been trying all king of sleep modes to put this board to sleep and get an external wake up when one of the floats makes can you help me i did this on a mega but with the core being different i can not get this mkr board to got to sleep and wake up on external input

@orton1970, although you picked a sensible category, your topic has been moved to the dedicated mkrnb1500 section of the forum as it did not get any replies yet.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.