example code using statis library for temperature measurement with LM35 and LM335

Dependencies:   mbed statis

tickerEvent.cpp

Committer:
greletj
Date:
2012-11-20
Revision:
1:5821fa15d6ca
Parent:
0:5ce1bc75ff24
Child:
5:0b3569945178

File content as of revision 1:5821fa15d6ca:

/*-------------------------------------------------------------------------*/
/*                       tickerEvent  class                                */
/*-------------------------------------------------------------------------*/
/*                    Ni-MH charger project US191 IRD                      */
/*-------------------------------------------------------------------------*/
/*                       Nov 2012 | J Grelet                               */
/*-------------------------------------------------------------------------*/


#include "tickerEvent.h"
 
// constructor
// _pin(pin) means pass pin to the DigitalOut constructor
tickerEvent::tickerEvent(PinName pin, float delay) : _pin(pin) { 
   // default the output to 0
   _pin = 0;                                           
   
  // Attach a function to be called by the Ticker, specifiying the interval delay in seconds. 
  _ticker.attach(this, &tickerEvent::toDo, delay);
}
 
// destructor
tickerEvent::~tickerEvent() {
}

// toDo method call by ticker
void tickerEvent::toDo(void) {
  _pin = !_pin;
}

// return state
int tickerEvent::read(void) {
  return _pin;
}