
Counts Interrupts From Joystick
Fork of Bootcamp-InterruptCounter by
Diff: main.cpp
- Revision:
- 1:6d3ead04d296
- Parent:
- 0:801eef032b63
--- a/main.cpp Wed Aug 07 19:44:57 2013 +0000 +++ b/main.cpp Wed Dec 11 20:10:01 2013 +0000 @@ -1,10 +1,12 @@ #include "mbed.h" +#include "C12832_lcd.h" class Counter { public: Counter(PinName pin) : _interrupt(pin) { // create the InterruptIn on the pin specified to Counter _interrupt.rise(this, &Counter::increment); // attach increment function of this counter instance + _interrupt.fall(this, &Counter::increment); } void increment() { @@ -19,12 +21,16 @@ InterruptIn _interrupt; volatile int _count; }; - -Counter counter(p5); - + + +C12832_LCD lcd; +Counter counter(p14); + int main() { while(1) { - printf("Count so far: %d\n", counter.read()); - wait(2); + + lcd.locate(0,0); + lcd.printf("Count so far: %d\n", counter.read()); + wait(0.5); } } \ No newline at end of file