LT-5016M1を74HC595で制御します。文字スクロールなどの参考にどうぞ。

Dependencies:   mbed

制作の過程はNotebookに書いています。

Revision:
0:679fb5e8a0b4
Child:
1:9f6c6dcdd8d7
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Sep 07 10:32:48 2016 +0000
@@ -0,0 +1,37 @@
+#include "mbed.h"
+
+DigitalOut RCK(PB_12);
+DigitalOut G(PB_1);
+DigitalOut SER(PC_6);
+DigitalOut CLK(PC_5);
+
+int main() {
+    SPI spi0(PB_15, PB_14, PB_13); //あ
+    spi0.format(8, 0);
+    spi0.frequency(100000000);
+    G = 0;
+    SER = 0; // 0=ON 1=OFF
+    CLK = 0;
+    CLK = 1;
+    
+    int count = 0;
+    while(1) {
+        for(int i=0; i<20; i++){
+            switch(count){
+                case 0: spi0.write(0b00000001); break;
+                case 1: spi0.write(0b00000010); break;
+                case 2: spi0.write(0b00000100); break;
+                case 3: spi0.write(0b00001000); break;
+                case 4: spi0.write(0b00010000); break;
+                case 5: spi0.write(0b00100000); break;
+                case 6: spi0.write(0b01000000); break;
+                case 7: spi0.write(0b10000000); break;
+            }
+        }
+        RCK = 0;
+        RCK = 1;
+        if(count==7) count=-1;
+        count++;
+        wait(0.2);
+    }
+}