123

Dependencies:   mbed

Revision:
0:03476464e975
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Jul 03 07:59:55 2019 +0000
@@ -0,0 +1,46 @@
+#include "mbed.h"
+
+InterruptIn ePin(PC_0);
+Serial pc(USBTX, USBRX);
+//DigitalIn a(PC_3);
+//DigitalIn b(PC_2);
+//DigitalIn c(PC_6);
+//DigitalIn d(PC_8);
+//DigitalIn e(PC_9);
+//DigitalIn f(PC_10);
+//DigitalIn g(PC_11);
+//DigitalIn h(PC_12);
+
+
+uint16_t inputBytes;
+uint8_t thereIsInputFlag = 0;
+
+PortIn  Portc(PortC, (1<<3)|(1<<2)|(1<<6)|(1<<8)|(1<<9)|(1<<10)|(1<<11)|(1<<12)); //(1<<10)|(1<<11)|...
+//PortIn  Porta(PortA, (1<<13)|(1<<14)|(1<<15)); 
+
+void inputHandler(){
+
+     inputBytes = Portc.read();
+     thereIsInputFlag = 1;
+}
+
+int main()
+{
+    ePin.mode(PullUp);
+    //a.mode(PullDown);
+    //b.mode(PullDown);
+    //c.mode(PullDown);
+    //d.mode(PullDown);
+    //e.mode(PullDown);
+    //f.mode(PullDown);
+    //g.mode(PullDown);
+    //h.mode(PullDown);          
+    pc.baud(19200);
+    ePin.fall(&inputHandler);
+    while(1){
+        if(thereIsInputFlag) {
+                pc.printf("%X", inputBytes);
+                thereIsInputFlag = 0;
+        }
+    }
+}