![](/media/cache/profiles/5f14615696649541a025d3d0f8e0447f.jpg.50x50_q85.jpg)
Simpe IoT BoardにGrove温度センサを繋げてIFTTTにプッシュするプログラムです。
Diff: SoftSerialSendOnly/SoftSerial_Ticker.h
- Revision:
- 0:26b07836cf44
diff -r 000000000000 -r 26b07836cf44 SoftSerialSendOnly/SoftSerial_Ticker.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SoftSerialSendOnly/SoftSerial_Ticker.h Fri Nov 13 07:55:43 2015 +0000 @@ -0,0 +1,38 @@ +//A modified version of the regular ticker/timeout libraries to allow us to do timeout without losing accuracy + +#ifndef FLEXTICKER_H +#define FLEXTICKER_H + +#include "mbed.h" + +class FlexTicker: public TimerEvent { + public: + template<typename T> + void attach(T* tptr, void (T::*mptr)(void)) { + _function.attach(tptr, mptr); + } + + /** Detach the function + */ + void detach() { + remove(); + } + + void setNext(int delay) { + insert(event.timestamp + delay); + } + + void prime(void) { + event.timestamp = us_ticker_read(); + } + +protected: + virtual void handler() { + _function.call(); + } + + unsigned int _delay; + FunctionPointer _function; +}; + +#endif \ No newline at end of file