Few Question about using sleep function

Hi everyone

  1. Can sleep mode System.sleep(wakeUpPin, edgeTriggerMode, seconds) work without time?
    (I want to wake the electron up everytime it senses the acceleration which greater than the threshold)

  2. About the WKP, I don’t understand how this work? I think that the system will wake up every time it senses something from sensor(in my case it accelerometer) , Does threshold have the effect on WKP?

  3. How setupLowpowermode work?, if I set the electron to this low power mode, how can I change the mode without using System.sleep(wakeUpPin, edgeTriggerMode, seconds)?

4.this is about GPS. Does gpsOn(); mean turn off gps and gpsOff(); means turn on ?

Thank you

As per the docs:

In all cases, if the wake up time seconds is omitted or 0, the application will keep sleeping until the wakeUpPin triggers (if specified) or the user hits the RESET button.

A RISING, FALLING, or CHANGE-ingslope will be detected. Thresholds will not matter and should be checked afterwards. Alternatively, configure your peripheral to send a signal only when its pre-configured threshold is reached.

Not sure what you're referring to, have you got a link?

if you look at the names, you can probably guess what they're supposed to do. If not, a link to whatever it is you're referring to would be great.

2 Likes

@Moors7, the WKP pin will ONLY wake the device from deep sleep using a RISING edge. This is as defined in the STM32F205 specs. If the WKP pin is use for waking for non deep sleep, then it behaves as you described.

2 Likes

Well , because of the description, I’m confused. And, in the library it said that gps Off() means HIGH which I understand that high mean let that pin work. I’m still confused.

I adapt from wake on me in the assettracker library. It use low power mode in reset state.

To , @peekay123 and @Moors7

By the way, thank you for your help.

1 Like

HIGH does not mean active. A lot of devices have "active LOW" pins.
e.g. the SlaveSelect pins on SPI devices are active LOW, meaning the respective slave is enabled/selected by pulling the pin LOW.

1 Like

Thank you :slight_smile: @ScruffR