Grelet Jacques
/
Ni-MH_V3
example code using statis library for temperature measurement with LM35 and LM335
Diff: tickerEvent.cpp
- Revision:
- 0:5ce1bc75ff24
- Child:
- 1:5821fa15d6ca
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tickerEvent.cpp Mon Nov 19 20:02:24 2012 +0000 @@ -0,0 +1,16 @@ +// tickerEvent.cpp +#include "tickerEvent.h" + +tickerEvent::tickerEvent(PinName pin, float delay) : _pin(pin) { // _pin(pin) means pass pin to the DigitalOut constructor + _pin = 0; // default the output to 0 + + // Attach a function to be called by the Ticker, specifiying the interval delay in seconds. + ticker.attach(this, &tickerEvent::toDo, delay); +} + +tickerEvent::~tickerEvent() { +} + +void tickerEvent::toDo(void) { + _pin = !_pin; +} \ No newline at end of file