Ticker 를 살렸다.

 

참고 사이트 : https://github.com/esp8266/Arduino/tree/master/libraries/Ticker

 

----------------- 소스  -----------------------

 

#include <Ticker.h>

#define LED D0


Ticker flipper;
unsigned int prt_index = 0;
void flip_test();


// the setup function runs once when you press reset or power the board
void setup() {
  Serial.begin(115200);
  delay(10);
  Serial.println("Start..");
 
  // initialize digital pin LED_BUILTIN as an output.
  pinMode(LED, OUTPUT);

  flipper.attach(0.3, flip_test);    //start , ms
  //flipper.detach(); //stop
 
}

// the loop function runs over and over again forever
void loop() {
 
  digitalWrite(LED, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);                       // wait for a second
  digitalWrite(LED, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);                       // wait for a second
}

void flip_test()
{
  prt_index ++;
  Serial.printf("%d",prt_index);
}

 

-----------------------------------------------

 

그외 사항 :

 

1. 기본 소스는 Ver 1.0 이다. 좀더 발전시킨 Ver 2.0 이 있다.

 

https://github.com/sstaub/Ticker

 

Ticker-master.zip

 

 

 

2. TickerScheduler 도 참고할만한것 같다.

 

https://github.com/Toshik/TickerScheduler

 

TickerScheduler-master.zip

 

 

 

 

'공부 > arduino' 카테고리의 다른 글

nodeMCU 참고 사이드  (0) 2018.03.10
nodeMCU pin MAP 다시보기  (0) 2018.03.09
아두이노 멀티 장비 설정  (0) 2018.03.07
nodemcu led 구동  (0) 2018.03.07
nodeMCU H/W특징  (0) 2018.03.06

+ Recent posts