mirror of
https://gitlab.waag.org/make/fablab/interns/2025/sam.git
synced 2025-08-04 04:14:56 +00:00
code update and presentation stuff
This commit is contained in:
@@ -42,6 +42,8 @@ void scrollingText(String text, int speed, int color);
|
||||
void playGif(const uint16_t* gifData[], int frameCount, int frameDelay);
|
||||
void displayFullScreenBMP(const uint16_t* bitmap);
|
||||
void bootSequence();
|
||||
void matrixSerialLoop();
|
||||
void matrixSerialSetup();
|
||||
|
||||
Adafruit_NeoMatrix matrix = Adafruit_NeoMatrix(32, 8, PIN,
|
||||
NEO_MATRIX_BOTTOM + NEO_MATRIX_RIGHT +
|
||||
@@ -56,15 +58,18 @@ void setup() {
|
||||
matrix.setTextWrap(false);
|
||||
matrix.setBrightness(25);
|
||||
matrix.setTextColor(matrix.Color(255, 255, 255));
|
||||
matrixSerialSetup();
|
||||
Serial.begin(9600);
|
||||
|
||||
bootSequence();
|
||||
// bootSequence();
|
||||
}
|
||||
|
||||
int x = matrix.width();
|
||||
int pass = 0;
|
||||
|
||||
void loop() {
|
||||
scrollingText("BOO AAAA!", 50, matrix.Color(255, 0, 255));
|
||||
scrollingText("Hello World!", 50, matrix.Color(255, 0, 255));
|
||||
// matrixSerialLoop();
|
||||
}
|
||||
|
||||
void scrollingText(String text, int speed, int color) {
|
||||
@@ -130,4 +135,28 @@ void bootSequence() {
|
||||
|
||||
delay(5000);
|
||||
|
||||
}
|
||||
|
||||
void matrixSerialSetup(){
|
||||
Serial1.begin(115200);
|
||||
}
|
||||
|
||||
void matrixSerialLoop() {
|
||||
if (Serial1.available()) {
|
||||
String command = Serial1.readStringUntil('\n');
|
||||
command.trim(); // Remove any trailing newline or spaces
|
||||
Serial.println("Received command: " + command);
|
||||
if (command.startsWith("scroll:")) {
|
||||
String text = command.substring(7); // Get the text after "scroll:"
|
||||
scrollingText(text, 50, matrix.Color(255, 0, 255));
|
||||
} else if (command.startsWith("gif:")) {
|
||||
// Handle GIF command
|
||||
// Example: gif:frame1,frame2,frame3
|
||||
// You would need to parse the frames and call playGif()
|
||||
} else if (command.startsWith("bmp:")) {
|
||||
// Handle BMP command
|
||||
// Example: bmp:bitmapData
|
||||
// You would need to parse the bitmap data and call displayFullScreenBMP()
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user