ADF mbed sport mode

Dependencies:   mbed

Revision:
0:bff5b3df0288
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Fri Jun 26 12:47:20 2015 +0000
@@ -0,0 +1,48 @@
+
+#include "mbed.h"
+#include<iostream>
+#define ENDL "\r" << endl;
+using namespace std;
+
+//Output
+DigitalOut gpo(D9);
+
+//clock
+InterruptIn clk(D8);
+int state=0;
+int j=0;
+int bit=7;
+unsigned char data [] = {0x55,0x55,0x55};
+void change()
+{
+        cout<<"Clock Detected"<<ENDL;
+        if(bit<0)
+        {
+            j++;
+            bit=7;
+           
+            if(j == 3){
+                j = 0;
+            }
+        }
+        if(state==0)
+        {
+            gpo = (data[j] >> bit--) & 0x01 ;
+            state++;
+        }
+        else if (state==1)
+        {
+            state=0;
+        }
+}           
+       
+int main()
+{  
+    printf("HELLO\r\n");
+    while(true)
+    {
+        cout << "hoo" << ENDL;
+        clk.fall(&change);
+        cout << "finished" << ENDL;
+    }
+}
\ No newline at end of file