![]() The complete code has variables in the main loop that functionally I dont want global. Why do you have an infinite loop in an infinite loop()? Serial port 0 outputs the data to a serial modem. The project powers up a sensing probe then reads text data at 9600 on Serial port 1. ![]() check serial port buffer if data available THE PROGRAM CONTINUES FROM HERE AFTER WAKING UP Sleep_mode() // here the device is actually put to sleep!! ![]() Sleep_enable() // enables the sleep bit in the mcucr register Set_sleep_mode(SLEEP_MODE_IDLE) // sleep mode is set hereĭetachInterrupt(digitalPinToInterrupt(pin_32K)) MainPortCommand() //intercept serial in from port 0 The following code sends the mega to sleep which wakes on serial input but it is missing the pin change #include ĪttachInterrupt(digitalPinToInterrupt(pin_32K), isr_32k, FALLING) I can command the device to sleepNow() and get a reduced current but need a different sleep function that does not detach Interrupt. The pin change interrupt counts a 32kHz clock IC pulse to set a 1 second flag for the main loop. Looking for some advice on how to wake my mega project from serial port input and pin change interrupt.
0 Comments
Leave a Reply. |