mirror of
https://github.com/esp8266/Arduino.git
synced 2025-07-27 18:02:17 +03:00
Fix Ticker callback casting. (#6282)
Fixes errors seen in #6281 and adds a slight test case to the examples to ensure no compiler errors.
This commit is contained in:
committed by
Develo
parent
7c6701512f
commit
8c37601614
@ -14,12 +14,17 @@
|
||||
#include <Ticker.h>
|
||||
|
||||
Ticker tickerSetHigh;
|
||||
Ticker tickerSetAnalog;
|
||||
Ticker tickerSetLow;
|
||||
|
||||
void setPin(int state) {
|
||||
digitalWrite(LED_BUILTIN, state);
|
||||
}
|
||||
|
||||
void setPinChar(char state) {
|
||||
digitalWrite(LED_BUILTIN, state);
|
||||
}
|
||||
|
||||
void setup() {
|
||||
pinMode(LED_BUILTIN, OUTPUT);
|
||||
digitalWrite(1, LOW);
|
||||
@ -27,8 +32,9 @@ void setup() {
|
||||
// every 25 ms, call setPin(0)
|
||||
tickerSetLow.attach_ms(25, setPin, 0);
|
||||
|
||||
// every 26 ms, call setPin(1)
|
||||
tickerSetHigh.attach_ms(26, setPin, 1);
|
||||
// every 26 ms, call setPinChar(1)
|
||||
tickerSetHigh.attach_ms(26, setPinChar, (char)1);
|
||||
|
||||
}
|
||||
|
||||
void loop() {
|
||||
|
Reference in New Issue
Block a user