1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
#ifndef COUNTER_H #define COUNTER_H #include "mbed.h" class Counter { private: InterruptIn _interrupt; volatile int _count; public: Counter(PinName pin); void increment(); int read(); void write(int new_count); }; #endif