Sleep Moddable Two #589
Replies: 3 comments 18 replies
-
I resolved with a deepSleep.c file with this funcion void xs_system_deepSleep (xsMachine * the) But now how can I do that during sleep it run my "RTC function" ? |
Beta Was this translation helpful? Give feedback.
-
@mauroForlimpopoli - when you report a problem (e.g. "give error in the compiler"), it would help if you could provide the error message and the complete example. My guess is that your didn't include the necessary header file, so you got an error like this:
This implementation of #include "xs.h"
#include "esp_sleep.h"
RTC_DATA_ATTR int wake_count;
void xs_deepSleep(xsMachine * the)
{
esp_sleep_enable_timer_wakeup(xsToInteger(xsArg(0)) * 1000);
esp_deep_sleep_start();
}
void xs_wakeCount(xsMachine * the)
{
xsResult = xsInteger(wake_count);
wake_count += 1;
} Here's a JavaScript example that deep sleeps for 500 seconds intervals and outputs the wake count on each wake. function deepSleep(ms) @ "xs_deepSleep"
function wakeCount() @ "xs_wakeCount"
trace(wakeCount() + "\n");
deepSleep(500); |
Beta Was this translation helpful? Give feedback.
-
The reset pins of the touch and display controllers are not connected to GPIO pins on Moddable Two. |
Beta Was this translation helpful? Give feedback.
-
Is there a way to put the moddable two in sleep mode ?
Beta Was this translation helpful? Give feedback.
All reactions