Go Down

Topic: How to display string message in multiple lines in DMD through Arduino UNO (Read 61 times) previous topic - next topic

prashantb2sharma

Hi,

I've stuck to print the multiple line in DMD board which get the message through the string,

Code: [Select]

#include <SPI.h>     
#include <DMD.h>
#include <TimerOne.h>
#include <stdio.h>
//#include <ledp10.h> 
#include "Arial_Black_16.h"<Arial_Black_16.h>
// you can remove the fonts if unused
#include "SystemFont5x7.h"
#define DISPLAYS_ACROSS 2
#define DISPLAYS_DOWN 1
#define DISPLAYS_BPP 1
#define WHITE 0xFF
#define BLACK 0
/* change these values if you have more than one DMD connected */
DMD dmd(DISPLAYS_ACROSS, DISPLAYS_DOWN);

int clearvar = 0;
char stringa[22];
char current ;
int i = 0;
int c = 0;


void ScanDMD()
{
  dmd.scanDisplayBySPI();
}

void setup()
{
   Timer1.initialize( 5000 );           
/*period in microseconds to call ScanDMD. Anything longer than 5000 (5ms) and you can see flicker.*/

   Timer1.attachInterrupt( ScanDMD ); 
/*attach the Timer1 interrupt to ScanDMD which goes to dmd.scanDisplayBySPI()*/

   dmd.clearScreen( true );           
/* true is normal (all pixels off), false is negative (all pixels on) */

Serial.begin(9600);

}

void loop() {
  // Read line from Serial
  memset(stringa, 0, sizeof(stringa)); // set string contents to zero
  Serial.setTimeout(1000); // second input timeout
  i = Serial.readBytesUntil('\n', stringa, sizeof(stringa)-0); // Read line of input
  if(i > 0) { // Display line if anything was read
    Serial.println(stringa);

    dmd.clearScreen(true);
    dmd.selectFont(SystemFont5x7);
    dmd.drawString( 0, 0, stringa , strlen(stringa), GRAPHICS_NORMAL);
         }
}


The string message is print in single line ...i need to print multiple line could you please me to resolve the issue...


Thanks
Prashant

Go Up