Skip to content

Instantly share code, notes, and snippets.

@adamwatters
Created May 19, 2015 05:28
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adamwatters/eed400038de3947c3b77 to your computer and use it in GitHub Desktop.
Save adamwatters/eed400038de3947c3b77 to your computer and use it in GitHub Desktop.
#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