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

Dependencies:   mbed

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

Revision:
3:68075c4a9ab4
Parent:
2:75c7836a6ff4
Child:
4:cd1ed9d15ef4
Child:
18:f18a00a1abf6
--- a/main.cpp	Mon Sep 19 12:45:16 2016 +0000
+++ b/main.cpp	Mon Sep 19 13:05:45 2016 +0000
@@ -12,6 +12,7 @@
  {0b00000000, 0b00000000, 0b00000000, 0b00000000},
  {0b00000000, 0b00000000, 0b00000000, 0b00000000}};
 char scan = 16; // 点灯中の行
+int scroll = 0; // 左スクロールした量
 
 void receive() {
     if(pc.getc() == 0b00000001) pc.printf("received!\r\n");
@@ -34,10 +35,9 @@
         } else if(scan == 1) {
             SER = 1; // 消灯
         }
-        spi.write(pattern[0][0]);
-        spi.write(pattern[0][1]);
-        spi.write(pattern[0][2]);
-        spi.write(pattern[0][3]);
+        for(int i=0; i<8; i++) spi.write(0x00000001 << scroll%8);
+        if(scan == 16) scroll++;
+        if(scroll > 8*8-1) scroll = 0;
         
         RCK = 0;
         CLK = 0;
@@ -45,7 +45,7 @@
         RCK = 1;
         CLK = 1;
         if(BUTTON) G = 0; // 点灯
-        while(timer.read_us()<100) {
+        while(timer.read_us()<100*500) {
             wait_us(10);
         }
 //        pc.printf("%f\r\n", timer.read());