FRA221_7B / Mbed 2 deprecated T1

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
lolopo008
Date:
Sat Dec 05 06:36:57 2015 +0000
Commit message:
a

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 19dc847021dd main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sat Dec 05 06:36:57 2015 +0000
@@ -0,0 +1,53 @@
+#include "mbed.h"
+
+SPI DataPack(SPI_MOSI, SPI_MISO, SPI_SCK);
+DigitalOut Latch(D10);
+AnalogIn VR0(A0);
+AnalogIn VR1(A1);
+Serial pc(USBTX, USBRX);
+
+int main()
+{
+    DataPack.frequency(100000);
+    DataPack.format(8,0);
+
+    float VR_value0,VR_value1;
+    int Row[8]= {1,2,4,8,16,32,64,128};
+    int Col[8]= {254,253,251,247,239,223,191,127};
+    int x;
+
+    while(1) {
+        VR_value0 = VR0.read();
+        VR_value1 = VR1.read();
+        VR_value0 = VR_value0*6;
+        VR_value1 = VR_value1*6;
+
+        for(x=1; x<7; x++) {
+            Latch=0;
+            DataPack.write(Col[4]);
+            wait_us(1);
+            DataPack.write(0xFF);
+            wait_us(1);
+            DataPack.write(0xFF);
+            wait_us(1);
+            DataPack.write(Row[x]);
+            wait_us(1);
+            Latch=1;
+            wait_ms(150);
+        }
+        
+        for(x=5; x>1; x--) {
+            Latch=0;
+            DataPack.write(Col[4]);
+            wait_us(1);
+            DataPack.write(0xFF);
+            wait_us(1);
+            DataPack.write(0xFF);
+            wait_us(1);
+            DataPack.write(Row[x]);
+            wait_us(1);
+            Latch=1;
+            wait_ms(150);
+        }
+    }
+}
diff -r 000000000000 -r 19dc847021dd mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sat Dec 05 06:36:57 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/9296ab0bfc11
\ No newline at end of file