LowPowerLab Forum

Software support => Coding questions => Topic started by: abucknum on June 10, 2019, 09:14:25 PM

Title: 'class LowPowerClass' has no member named 'powerDown'
Post by: abucknum on June 10, 2019, 09:14:25 PM
I am attempting to use the LowPower library at https://github.com/LowPowerLab/LowPower using a Moteino M0. When I attempt to compile the example "powerDownWakePeriodic", I get the following error:

Code: [Select]
C:\Users\skier\AppData\Local\Temp\arduino_modified_sketch_79047\powerDownWakePeriodic.ino: In function 'void loop()':

powerDownWakePeriodic:12:14: error: 'class LowPowerClass' has no member named 'powerDown'

     LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF); 


exit status 1
'class LowPowerClass' has no member named 'powerDown'

However, when I select Moteino / Moteino USB in Tools => Board, the code compiles fine. I can't seem to find anything wrong with the code, is there something I am missing?

- Arduino IDE 1.8.9
- Tried 1.2.0, 1.1.0, and 1.0.0 LowPowerLab SAMD Boards in Boards Manager with same results


Title: Re: 'class LowPowerClass' has no member named 'powerDown'
Post by: Felix on June 10, 2019, 09:30:46 PM
That example is for AVR.
For SAMD use this example:

Or if you want periodic waking for SAMD21 you can use the RTCZero library, here's a modded example of that for MOTEINO_M0:

Code: [Select]
#include <RTCZero.h>

RTCZero zerortc;

// Set how often alarm goes off here
const byte alarmSeconds = 3;
const byte alarmMinutes = 0;
const byte alarmHours = 0;

volatile bool alarmFlag = false; // Start awake

#if defined (MOTEINO_M0)
    #define Serial SERIAL_PORT_USBVIRTUAL // Required for Serial on Zero based boards

void setup()
  delay(3000); // Wait for console
  digitalWrite(LED_BUILTIN, LOW);

  zerortc.begin(); // Set up clocks and such
  pinMode(PIN_ATN, OUTPUT);
  resetAlarm();  // Set alarm
  zerortc.attachInterrupt(alarmMatch); // Set up a handler for the alarm

void loop()
  if (alarmFlag == true) {
    alarmFlag = false;  // Clear flag
    digitalWrite(LED_BUILTIN, HIGH);
    digitalWrite(PIN_ATN, HIGH);
    Serial.println("Alarm went off - I'm awake!");
  resetAlarm();  // Reset alarm before returning to sleep
  Serial.println("Alarm set, going to sleep now.");
  digitalWrite(LED_BUILTIN, LOW);
  digitalWrite(PIN_ATN, LOW);
  zerortc.standbyMode();    // Sleep until next alarm match

void alarmMatch(void)
  alarmFlag = true; // Set flag

void resetAlarm(void) {
  byte seconds = 0;
  byte minutes = 0;
  byte hours = 0;
  byte day = 1;
  byte month = 1;
  byte year = 1;
  zerortc.setTime(hours, minutes, seconds);
  zerortc.setDate(day, month, year);

  zerortc.setAlarmTime(alarmHours, alarmMinutes, alarmSeconds);
Title: Re: 'class LowPowerClass' has no member named 'powerDown'
Post by: abucknum on June 11, 2019, 01:42:40 AM
Ah - thanks for the quick response!