How to put spark core to sleep and wakeup on interrupt signal on a pin?

I have tried out a minimal test of this new sleep code:

#include "application.h"

int led2 = D1;
int intPin = D0;
SYSTEM_MODE(MANUAL);

void setup()
{
  pinMode(led2, OUTPUT);
  Spark.sleep(intPin, FALLING, 60);
}
void loop()
{
  digitalWrite(led2, HIGH);
  delay(1000);
  digitalWrite(led2, LOW); 
 }

locally compiled and flashed with the new firmware and my core simply flashes green 3 times fast then white once long and immediately repeats. What am I doing wrong?

1 Like