Description

setWkUpSources() – configures the triggers that should be able to wake up the device during the next invocation of the sleep() method. The input parameters are a set of OR’ed defines so that the user can select the desired set of wake ups.

Syntax

LowPower.setWkUpSources( WkUpSources );

Parameters


uint8_t WkUpSources– the following values can be used to configure the wake up triggers:

  • LOWPOWER_WKUP_IGN – wakeup from a L/H transition at the ignition pin
  • LOWPOWER_WKUP_RTC – the real time clock will trigger the system wake up
  • LOWPOWER_WKUP_ACC – acceleration sensor interrupt (e.g. triggered by motion)
  • LOWPOWER_WKUP_CAN0 – data traffic on the main CAN bus (MCAN0)
  • LOWPOWER_WKUP_CAN1 – data traffic on the second CAN bus (MCAN1 if applicable)
  • LOWPOWER_WKUP_USB – wake up triggered by connecting to USB host.

Returns

nothing

Example Code

The following example configures the device to wake up after 10 seconds and at a L/H transition on the ignition pin.

#include "LowPowerSAMC.h"
void setup()
{  
  LowPower.setWkUpSources( LOWPOWER_WKUP_IGN | LOWPOWER_WKUP_RTC ); 
}
void loop () 
{
  digitalWrite(LED_BUILTIN, LOW);
  uint8_t u8_ret = LowPower.sleep(10000);
  Serial.print("Wakeup reason: ");
  if(u8_ret & LOWPOWER_WKUP_IGN) Serial.println("IGNITION");
  if(u8_ret & LOWPOWER_WKUP_RTC) Serial.println("RTC");
  digitalWrite(LED_BUILTIN, HIGH);
  delay(2000);
}

Examples can be found in the Arduino IDE menu:
File -> Examples -> LowPowerSAMC

See also

sleep()