i trying make sleepy pi wake rpi regular intervals. when run example code wakeuppionalarm no modifications, pi wakes once. after next shutdown, doesn't start expected. rpi set program starts @ bootup , sends "shutdown -h now" command @ end of task, , want sleepy pi start rpi again after few hours , repeat. how can make sleep/wake process run indefinitely?
here code, copied sleepy pi example:
here code, copied sleepy pi example:
code: select all
// // simple example showing how set rtc alarm pin wake arduino // , power raspberry pi // // **** includes ***** #include "sleepypi.h" #include <time.h> #include <lowpower.h> #include <ds1374rtc.h> #include <wire.h> const int led_pin = 13; void alarm_isr() { // handler alarm interrupt. // here } void setup() { // configure "standard" led pin pinmode(led_pin, output); digitalwrite(led_pin,low); // switch off led sleepypi.enablepipower(false); // initialize serial communication: in arduino ide use "serial monitor" serial.begin(9600); } void loop() { // allow wake alarm trigger interrupt on falling edge. attachinterrupt(0, alarm_isr, falling); // alarm pin sleepypi.enablewakeupalarm(); sleepypi.setalarm(10); // in seconds // enter power down state adc , bod module disabled. // wake when wake pin low. sleepypi.powerdown(sleep_forever, adc_off, bod_off); // disable external pin interrupt on wake pin. detachinterrupt(0); // here // example: read sensor, data logging, data transmission. sleepypi.enablepipower(true); serial.println("i've woken up"); digitalwrite(led_pin,high); // switch on led delay(250); digitalwrite(led_pin,low); // switch off led }
raspberrypi
Comments
Post a Comment