multitasking

The Dot Matrix Display (DMD) is a 32x16 array of high-brightness LEDs for visually striking effects. [Product Page]
Post Reply
roman
Posts: 3
Joined: Tue Feb 06, 2018 4:39 am

multitasking

Post by roman » Tue Feb 06, 2018 6:40 am

hi
i am able to display the counter at right corner and scroll message which will start from end of the display till the center of display.
only i need to do is to do both task of increment the counter and scrolling the message at once.
i am using DMD2 library
i have gone through many suggestion but still not able to solve my problem.

Code: Select all

/*
  Scrolling alphabet demo, displays characters one at a time into a scrolling box.
 */

#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;
// You can change to a smaller font (two lines) by commenting this line,
// and uncommenting the line after it:
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); // box to display counter
DMD_TextBox box1(dmd,11,1);  //box to scroll message

// the setup routine runs once when you press reset:
void setup() {
  Serial.begin(9600);
  dmd.setBrightness(255);
  //dmd.selectFont(FONT);
  dmd.begin();  
}

// the loop routine runs over and over again forever:
void loop() {
  dmd.selectFont(FONT);
  box.print(counter);
  dmd.selectFont(FONT2);
  const char *next = MESSAGE;
 while(*next) {
  Serial.print(*next);
  box1.print(*next);
  delay(500);
  next++;
  }
    box.println(F(""));
    counter++;
    if(counter == 60) {
    dmd.clearScreen();
    counter = 0;
  }  
}

Post Reply