Wakeup via Pin Interrupt

I have an electron with firmware 0.6.2. I use the following sleep command

System.sleep(D1, RISING, SLEEP_NETWORK_STANDBY, 120);

The system will wakeup after two minutes, but will not wkaeup when D1 gose high. (using a scope I see it come from 2mn to 3.25V

I have initialized D1 as

pinMode(D1, INPUT);

Do I also need to initialize it as an interrupt for this to work?

Normally you’n not need to initialise the wake pin at all since System.sleep() should do this implicitly.
But if you did it would need to be INPUT_PULLDOWN (or an external pull-down) to detect a rising edge.


Update:
I have now tested on my own Electron and as expected it just wakes as expected.
Try this simple sketch

void setup() { }
void loop() 
{
  delay(5000);
  System.sleep(D1, RISING, SLEEP_NETWORK_STANDBY, 120);
}

Double check you are actually using D1 and not D0.
Since the silk print has the pin name below the pin it’s easy to mix them up - I keep looking at the side of the pin headers where the pin names are less “confusing”.

2 Likes

I am definitely using the correct pin.

It has an external pulldown of 68K. The voltage swing is from 2mv to 3.25V. I removed all initialization code for D1 and it still does not work.

I tried A3 and that pin does work. D1 is supposed to be an allowable interrupt pin. Not sure why D1 will not work for me.