Add Ticker library (#1057)

* Add Ticker library

* Fix CI (#1)

remove LED_BUILTIN in examples
This commit is contained in:
Bert Melis
2018-03-04 20:34:03 +01:00
committed by Me No Dev
parent f5c2afff31
commit 8e29347d4f
6 changed files with 257 additions and 0 deletions

View File

@ -0,0 +1,27 @@
#include <Arduino.h>
#include <Ticker.h>
// attach a LED to GPIO 21
#define LED_PIN 21
Ticker tickerSetHigh;
Ticker tickerSetLow;
void setPin(int state) {
digitalWrite(LED_PIN, state);
}
void setup() {
pinMode(LED_PIN, OUTPUT);
digitalWrite(1, LOW);
// every 25 ms, call setPin(0)
tickerSetLow.attach_ms(25, setPin, 0);
// every 26 ms, call setPin(1)
tickerSetHigh.attach_ms(26, setPin, 1);
}
void loop() {
}