![](/media/cache/profiles/f80ff32e08a25270b5f252ce39522f72.50x50_q85.jpg)
h_and_c_files/Counter.cpp
- Committer:
- joe
- Date:
- 2010-08-20
- Revision:
- 0:960b355eaa84
File content as of revision 0:960b355eaa84:
#include "mbed.h" #include "Counter.h" Counter::Counter(PinName pin) : _interrupt (pin) { // attach rising edge to rising function _interrupt.rise(this, &Counter::rising); // Initialise the counter to 0 _count = 0; } // On a rising edge, increment the counter void Counter::rising() { _count++; } // return the current count int Counter::read() { return _count; } // Reset the counter void Counter::reset() { _count = 0; }