Counts Interrupts From Joystick

Dependencies:   C12832_lcd mbed

Fork of Bootcamp-InterruptCounter by avnish aggarwal

Files at this revision

API Documentation at this revision

Comitter:
Cabal51
Date:
Wed Dec 11 20:10:01 2013 +0000
Parent:
0:801eef032b63
Commit message:
Lab3 Interrupt Counter

Changed in this revision

C12832_lcd.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 801eef032b63 -r 6d3ead04d296 C12832_lcd.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/C12832_lcd.lib	Wed Dec 11 20:10:01 2013 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/dreschpe/code/C12832_lcd/#c9afe58d786a
diff -r 801eef032b63 -r 6d3ead04d296 main.cpp
--- 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