From 7ed25068b176eb7b1b899ee02253e86766677fc4 Mon Sep 17 00:00:00 2001 From: wujiayi Date: Tue, 31 Oct 2017 14:02:30 +0800 Subject: [PATCH 1/3] Add an example Move an arrow or a figure --- .../LCDemoMovingArrow/LCDemoMovingArrow.ino | 67 +++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 examples/LCDemoMovingArrow/LCDemoMovingArrow.ino diff --git a/examples/LCDemoMovingArrow/LCDemoMovingArrow.ino b/examples/LCDemoMovingArrow/LCDemoMovingArrow.ino new file mode 100644 index 00000000..e2ae38bb --- /dev/null +++ b/examples/LCDemoMovingArrow/LCDemoMovingArrow.ino @@ -0,0 +1,67 @@ +#include + +int DIN = 12; +int CS = 11; +int CLK = 10; + +byte arrow[8]= {0x18,0x3C,0x5A,0x99,0x18,0x18,0x18,0x24}; +byte love[8]= {0x00,0x46,0xB9,0x81,0x42,0x24,0x18,0x00}; +byte smile[8]= {0x3C,0x42,0xA5,0x81,0xA5,0x99,0x42,0x3C}; + +LedControl lc=LedControl(DIN,CLK,CS,4); + +void setup() +{ + for (int i = 0; i <= 3; i++) { + lc.shutdown(i,false); + lc.setIntensity(i, 3); + lc.clearDisplay(i); + } +} + +void loop() +{ + // Display moving graphics + // Passing an array of graphics through parameters :) + moving(arrow); + moving(love); + moving(smile); +} + +void moving (byte array_date []) +{ + printByte_in(array_date, 0); + for (int i = 0; i <= 3; i++) + printByte_zhong(array_date, i); +} + +void printByte_in(byte character [], int addr) +{ + int i = 0, column = 0, value = 0; + for (i = 0; i <= 7; i++) { + value = -1; + for (column = 7 - i; column <= 7; column++) { + value++; + lc.setColumn(addr,column,character[value]); + } + delay(40); + } +} + +void printByte_zhong(byte character [], int addr) +{ + int sum = 0, value = 0, character_value = 0, range = 0; + int i = 0, j = 0; + + for (i = 7, range = 0, value = 1; i >= 0; i--, range++, value++) { + for (j = 7 - range, character_value = 0; j <= 7; j++, character_value++) + lc.setColumn(addr + 1, j, character[character_value]); + for (j = 0; j <= i - 1; j++) { + sum = j + value; + lc.setColumn(addr, j, character[sum]); + } + lc.setColumn(addr, j, 0x00); + lc.setColumn(addr + 1, j, character[sum]); + delay(20); + } +} From fe9f3e5261a5efb1dcb956e206edf6e26944e272 Mon Sep 17 00:00:00 2001 From: HelloWuJiaYi Date: Sat, 4 Nov 2017 18:20:58 +0800 Subject: [PATCH 2/3] test --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7e2b71e4..c4809c3d 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -LedControl +LedControll ========== LedControl is an [Arduino](http://arduino.cc) library for MAX7219 and MAX7221 Led display drivers. The code also works with the [Teensy (3.1)](https://www.pjrc.com/teensy/) From 176e1b4638d9c6c9b2671ef9ee4abbd1b2090bcb Mon Sep 17 00:00:00 2001 From: HelloWuJiaYi Date: Sat, 4 Nov 2017 18:38:00 +0800 Subject: [PATCH 3/3] test gitshell --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c4809c3d..7e2b71e4 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -LedControll +LedControl ========== LedControl is an [Arduino](http://arduino.cc) library for MAX7219 and MAX7221 Led display drivers. The code also works with the [Teensy (3.1)](https://www.pjrc.com/teensy/)