mirror of
https://github.com/Xinyuan-LilyGO/TTGO_TWatch_Library.git
synced 2026-03-06 16:16:56 +01:00
Add T-block led matrix example
This commit is contained in:
36
examples/T-Block/LEDMatrix/LEDMatrix.ino
Normal file
36
examples/T-Block/LEDMatrix/LEDMatrix.ino
Normal file
@@ -0,0 +1,36 @@
|
||||
|
||||
#pragma mark - Depend MAX7219LedMatrix library
|
||||
/*
|
||||
cd ~/Arduino/libraries
|
||||
git clone https://github.com/Xinyuan-LilyGO/MAX7219LedMatrix
|
||||
*/
|
||||
|
||||
|
||||
#include <SPI.h>
|
||||
#include <LedMatrix.h>
|
||||
|
||||
#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);
|
||||
}
|
||||
Reference in New Issue
Block a user