-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add define SLEEP_MODE to allow the user to specify the used sleep mode.
- Loading branch information
Showing
3 changed files
with
40 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// do not use SLEEP_MODE_PWR_DOWN to prevent that | ||
// the asynchronous clock is stopped | ||
#define SLEEP_MODE SLEEP_MODE_PWR_SAVE | ||
// show then the CPU is active on PIN 13 | ||
#define AWAKE_INDICATION_PIN 13 | ||
#include <DeepSleepScheduler.h> | ||
|
||
// the PWM signal can only be used in sleep mode on | ||
// Arduino UNO PINs 3 and 11 because only these two | ||
// use an asynchronous clock that is not stopped | ||
// with SLEEP_MODE_PWR_SAVE | ||
#define PWN_PIN 3 | ||
|
||
void highValue() { | ||
analogWrite(PWN_PIN, 200); | ||
scheduler.scheduleDelayed(lowValue, 5000); | ||
} | ||
|
||
void lowValue() { | ||
analogWrite(PWN_PIN, 100); | ||
scheduler.scheduleDelayed(highValue, 5000); | ||
} | ||
|
||
void setup() { | ||
pinMode(PWN_PIN, OUTPUT); | ||
scheduler.schedule(lowValue); | ||
} | ||
|
||
void loop() { | ||
scheduler.execute(); | ||
} | ||
|