Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Troubleshooting
  3. Node is rebooted by waking up from a sleep

Node is rebooted by waking up from a sleep

Scheduled Pinned Locked Moved Troubleshooting
1 Posts 1 Posters 18 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • alexsh1A Offline
    alexsh1A Offline
    alexsh1
    wrote on last edited by
    #1

    Hi all,

    I have the following code which constantly reboots my node when Interrupted by PIR.
    Any idea why?

    //#define MY_DEBUG_VERBOSE_SIGNING
    //#define MY_SPLASH_SCREEN_DISABLED
    
    // Enable and select radio type attached
    #define MY_RADIO_RFM69
    #define MY_RFM69_NEW_DRIVER
    #define MY_RFM69_ATC_MODE_DISABLED
    #define MY_RFM69_FREQUENCY RFM69_868MHZ
    #define MY_PARENT_NODE_IS_STATIC
    #define MY_PARENT_NODE_ID 0
    #define MY_RFM69_NETWORKID (100)
    #define MY_NODE_ID 3
    
    #define INT_PIN 6
    #define INT_PINN 7
    #define SLEEP_TIME 9000000  // 15 min
    uint32_t sleepTime = SLEEP_TIME;
    int8_t wakeupReason = 0;
    
    #include <MySensors.h>
    
    void setup() {
      Serial.begin(115200);
      PCMSK2 |= bit(PCINT22);
      PCMSK2 |= bit(PCINT23);
      PCIFR |= bit(PCIF2);  // clear any outstanding interrupts
      PCICR |= bit(PCIE2);  // enable pin change interrupts for D0 to D7
      delay(2000);
      pinMode(INT_PIN, INPUT);
      pinMode(INT_PINN, INPUT);
    }
    
    
    void loop() {
      if (wakeupReason == digitalPinToInterrupt(INT_PIN) || wakeupReason == digitalPinToInterrupt(INT_PINN)) {
        Serial.println("Sleep Interrupted!");
        digitalWrite(9, HIGH);
        delay(20);
        digitalWrite(9, LOW);
        // Report sensor status here
      } else if (wakeupReason == MY_WAKE_UP_BY_TIMER) {
        Serial.println("MY_WAKE_UP_BY_TIMER");
        // Report battery level here
      }
      wakeupReason = sleep(digitalPinToInterrupt(INT_PIN), CHANGE, digitalPinToInterrupt(INT_PINN), CHANGE, sleepTime);
    }
    
    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    19

    Online

    11.7k

    Users

    11.2k

    Topics

    113.1k

    Posts


    Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • MySensors
    • OpenHardware.io
    • Categories
    • Recent
    • Tags
    • Popular