#include <Adafruit_GFX.h> | |
#include <Adafruit_NeoMatrix.h> | |
#include <Adafruit_NeoPixel.h> | |
#include <Bridge.h> | |
#include <HttpClient.h> | |
#define PIN 6 | |
Adafruit_NeoMatrix matrix = Adafruit_NeoMatrix(8, 8, 3, 1, PIN, | |
NEO_TILE_TOP + NEO_TILE_LEFT + NEO_TILE_ROWS + NEO_TILE_PROGRESSIVE + | |
NEO_MATRIX_TOP + NEO_MATRIX_LEFT + NEO_MATRIX_ROWS + NEO_MATRIX_PROGRESSIVE, | |
NEO_GRB + NEO_KHZ800); | |
const uint16_t colors[] = { | |
matrix.Color(0, 210, 230), matrix.Color(170, 255, 100), matrix.Color(250, 0, 250) }; | |
void setup() { | |
Bridge.begin(); | |
matrix.begin(); | |
matrix.setTextWrap(false); | |
matrix.setBrightness(5); | |
matrix.setTextColor(colors[0]); | |
} | |
int x = matrix.width(); | |
int flag = 0; | |
int pass = 0; | |
int messagePixelLength; | |
String message; | |
void loop() { | |
if (flag == 0) { | |
message = ""; | |
HttpClient client; | |
// your endpoint goes below | |
client.get("http://www.yourwebsite.com/yourendpoint"); | |
while (client.available()) { | |
message = message + String(client.readString()); | |
} | |
flag = 1; | |
} | |
messagePixelLength = -6 * message.length(); | |
matrix.fillScreen(0); | |
matrix.setCursor(x, 0); | |
matrix.print(message); | |
x = x - 1; | |
if(x < messagePixelLength) { | |
x = matrix.width(); | |
if(++pass >= 3) pass = 0; | |
flag = 0; | |
matrix.setTextColor(colors[pass]); | |
} | |
matrix.show(); | |
delay(20); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment