True sleep declaration

Hi everybody,

I found this call in the electron reference:
System.sleep(wakeUpPin, edgeTriggerMode, SLEEP_NETWORK_STANDBY, seconds);

I found this call in the assettracker sample and on the forum:
System.sleep(WKP, RISING, seconds, SLEEP_NETWORK_STANDBY);

Where is the truth?

@Alik, the truth is both are correct. If you don’t specify the seconds parameter, it will be set to zero, ie no timed wakeup. :slight_smile:

A seconds argument is specified in the OP's second example, but it's in the wrong place in the argument list. I believe he's referring to this statement in the WakeOnMove.ino example in the AssetTracker library:

	System.sleep(WKP, RISING, TIME_PUBLISH_BATTERY_SEC, SLEEP_NETWORK_STANDBY);

TIME_PUBLISH_BATTERY_SEC is defined as:

const unsigned long TIME_PUBLISH_BATTERY_SEC = 4 * 60 * 60; // every 4 hours, send a battery update

I don't see any version of the sleep command in the docs, that supports this order of arguments. Is this an undocumented feature, or an error in the library example?

1 Like

Thanks! :slight_smile: