* ------ [ACC_5] Waspmote Accelerometer Inertial Wake Up Example ------
* Explanation: This example shows how to manage the inertial wake up
* Copyright (C) 2016 Libelium Comunicaciones Distribuidas S.L.
* http://www.libelium.com
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
* Implementation: Marcos Yarza
USB.println(F("ACC_05 example"));
///////////////////////////////////////////////
// 1. Starts accelerometer
///////////////////////////////////////////////
///////////////////////////////////////////////
// 2. Enable interruption: Inertial Wake Up
///////////////////////////////////////////////
///////////////////////////////////////////////
// 3. Set low-power consumption state
///////////////////////////////////////////////
USB.println(F("Waspmote goes into sleep mode until the Accelerometer causes an interrupt"));
// Interruption event happened
///////////////////////////////////////////////
// 4. Disable interruption: Inertial Wake Up
// This is done to avoid new interruptions
///////////////////////////////////////////////
USB.println(F("Waspmote wakes up"));
///////////////////////////////////////////////
// 5. Check the interruption source
///////////////////////////////////////////////
// clear interruption flag
USB.println(F("++++++++++++++++++++++++++++"));
USB.println(F("++ ACC interrupt detected ++"));
USB.println(F("++++++++++++++++++++++++++++"));
* Insert your code here if more things needed
///////////////////////////////////////////////////////////////////////
// 6. Clear interruption pin
///////////////////////////////////////////////////////////////////////
// This function is used to make sure the interruption pin is cleared
// if a non-captured interruption has been produced
PWR.clearInterruptionPin();