hello
i have a LED p10 matrix 32*16 and an arduino uno board and i am using DMD2 library.
i need to print two messages on the board one will be a counter on left side and second is a string message.
the counter should run continuously and the message should scroll from right to left but need to end where the counter is ending.
OK you have permission to do so, Or is there a question?
If so please post your code you have so far, tell us what it does and what you expected.
Also a link to DMD2 library is usefull as I do no know it.
gourish
February 5, 2018, 11:56am
3
#include <SPI.h>
#include <DMD2.h>
#include <fonts/SystemFont5x7.h>
#include <fonts/Arial14.h>
#include <fonts/Droid_Sans_24.h>
#include <fonts/Droid_Sans_16.h>
// Set Width to the number of displays wide you have
const int WIDTH = 1;
const int COUNTDOWN_FROM = 0;
int counter = COUNTDOWN_FROM;
const uint8_t *FONT = SystemFont5x7;
const uint8_t *FONT2 = SystemFont5x7;
const char *MESSAGE = "GOA ";
SoftDMD dmd(WIDTH,1); // DMD controls the entire display
DMD_TextBox box(dmd, 0, 1);
DMD_TextBox box1(dmd,11,1); // "box" provides a text box to automatically write to/scroll the display
long previousMillis = 0; // will store last time box was updated
long interval = 1000;
unsigned long previousMillis2 = 0;
long interval2 = 1000;
void scroll();
void run_counter();
// the setup routine runs once when you press reset:
void setup() {
Serial.begin(9600);
dmd.setBrightness(255);
//dmd.selectFont(FONT);
dmd.begin();
}
void loop() {
// put your main code here, to run repeatedly:
unsigned long currentMillis = millis();
if(currentMillis - previousMillis > interval) {
previousMillis = currentMillis;
if (counter <60)
{
dmd.selectFont(FONT);
box.print(counter);
box.println(F(""));
counter++;
}
else
{
box1.clear();
counter = 0;
box.print(counter);
// box.println(F(""));
dmd.clearScreen();
}
}
if((counter <60)&&(currentMillis - previousMillis2 >= interval2))
{
previousMillis2 = currentMillis; // Remember the time
dmd.selectFont(FONT2);
const char *next = MESSAGE;
while(*next) {
Serial.print(*next);
box1.print(*next);
delay(500);
next++;
}
}
else
{
box1.clear();
counter = 0;
box.print(counter);
// box.println(F(""));
dmd.clearScreen();
}
}
the counter counts till 60 on the left side of the display and the message goa scrolls from right to the center of the display.
as the counter reaches 60 the entire screen is cleared.
DMD2.zip (51.1 KB)