From 89eab0219eff63f46409e41d4dfb92ddf88ea45d Mon Sep 17 00:00:00 2001 From: lewis he Date: Thu, 9 Apr 2020 12:02:30 +0800 Subject: [PATCH] Add T-block led matrix example --- examples/T-Block/LEDMatrix/LEDMatrix.ino | 36 ++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 examples/T-Block/LEDMatrix/LEDMatrix.ino diff --git a/examples/T-Block/LEDMatrix/LEDMatrix.ino b/examples/T-Block/LEDMatrix/LEDMatrix.ino new file mode 100644 index 0000000..9a06fc8 --- /dev/null +++ b/examples/T-Block/LEDMatrix/LEDMatrix.ino @@ -0,0 +1,36 @@ + +#pragma mark - Depend MAX7219LedMatrix library +/* +cd ~/Arduino/libraries +git clone https://github.com/Xinyuan-LilyGO/MAX7219LedMatrix +*/ + + +#include +#include + +#define NUMBER_OF_DEVICES 8 + +//! T-Block led Matrix +#define MATRIX_MSIO 23 //No use +#define MATRIX_MOSI 18 +#define MATRIX_CS 19 +#define MATRIX_SCLK 14 + +LedMatrix ledMatrix = LedMatrix(NUMBER_OF_DEVICES, MATRIX_CS); + +void setup() +{ + SPI.begin(MATRIX_SCLK, MATRIX_MSIO, MATRIX_MOSI, MATRIX_CS); + ledMatrix.init(); + ledMatrix.setText("Hello world"); +} + +void loop() +{ + ledMatrix.clear(); + ledMatrix.scrollTextLeft(); + ledMatrix.drawText(); + ledMatrix.commit(); + delay(50); +} \ No newline at end of file