forked from arduino/ArduinoCore-arc32
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Jira-528. Make CurieTimerOne library to be compatible with the TimerO…
…ne library originated from Paul. Created methods that have the same name and functionalities as in the TimerOne library.
- Loading branch information
1 parent
98ee736
commit 38a508e
Showing
4 changed files
with
168 additions
and
52 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
libraries/CurieTimerOne/examples/CurieTimer1BlinkSpeed/blinkSpeed.ino
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,30 @@ | ||
#include <CurieTimerOne.h> | ||
|
||
const int blinkPin = 13; | ||
|
||
void setup(void) | ||
{ | ||
CurieTimerOne.initialize(50000); | ||
Serial.begin(9600); | ||
} | ||
|
||
void loop(void) | ||
{ | ||
unsigned int range; | ||
|
||
Serial.println("PWM blink: low -> high duty cycle"); | ||
|
||
for (float dutyCycle = 5.0; dutyCycle <= 100.0; dutyCycle++) { | ||
range = (dutyCycle / 100) * 1023; | ||
CurieTimerOne.pwm(blinkPin, range); | ||
delay(50); | ||
} | ||
|
||
Serial.println("PWM blink: high -> low duty cycle"); | ||
|
||
for (float dutyCycle = 100.0; dutyCycle > 5.0; dutyCycle--) { | ||
range = (dutyCycle / 100) * 1023; | ||
CurieTimerOne.setPwmDuty(blinkPin, range); | ||
delay(50); | ||
} | ||
} |
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