Need a little help DMD and Serial Input

The Dot Matrix Display (DMD) is a 32x16 array of high-brightness LEDs for visually striking effects. [Product Page]
coromonadalix
Posts: 26
Joined: Wed Apr 09, 2014 9:03 pm

Re: Need a little help DMD and Serial Input

Post by coromonadalix » Thu Sep 04, 2014 11:01 am

hello No luck either, it seem to miss more characters ???

the characters problems is there past the second one ...........

angusgr
Freetronics Staff
Freetronics Staff
Posts: 853
Joined: Tue Apr 09, 2013 11:19 pm
Location: Melbourne, Australia
Contact:

Re: Need a little help DMD and Serial Input

Post by angusgr » Sun Sep 07, 2014 10:43 pm

coromonadalix wrote:hello No luck either, it seem to miss more characters ???

the characters problems is there past the second one ...........
Hi coromonadalix,

I just ran the following sketch (which is the setup function you posted and the loop function I posted) on an Eleven, and it echos back full lines when I send them to it with the Arduino Serial Monitor.

Code: Select all

#include "SPI.h"
#include "DMD.h"
#include "TimerOne.h"
//#include "Arial_black_16.h"<arial_black_16.h>
#include "SystemFont5x7.h"
#define DISPLAYS_ACROSS 4
#define DISPLAYS_DOWN 1
DMD dmd(DISPLAYS_ACROSS, DISPLAYS_DOWN);

int clearvar = 0;
char stringa[20];
int i = 0;

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

void setup()
{
  Timer1.initialize( 5000 );
  Timer1.attachInterrupt( ScanDMD );
  dmd.clearScreen( true );
  Serial.begin(115200);
}

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)-1); // Read line of input
  if(i > 0) { // Display line if anything was read
    Serial.println(stringa);

    dmd.clearScreen(true);
    dmd.selectFont(SystemFont5x7);
    dmd.drawString( 1, 4, stringa , strlen(stringa), GRAPHICS_NORMAL );
  }
}
The Arduino Serial Monitor sends to the board a full line at a time. If you're typing characters one at a time, you may need to update the timeout:

Code: Select all

Serial.setTimeout(1000); // second input timeout
To more than 1000 (1 second), as this is the timeout for the entire line to be received. Perhaps try 30000 or 60000?

Does any of this help?


Angus

coromonadalix
Posts: 26
Joined: Wed Apr 09, 2014 9:03 pm

Re: Need a little help DMD and Serial Input

Post by coromonadalix » Mon Sep 08, 2014 2:00 am

hi
If i play with : Serial.setTimeout(1000); ex: 2000,3000,4000 as values it slow down the response speed / augment the delay to display what i am sending.

Still the 2 first characters are good and the last one is displayed ....

User avatar
stryker
Posts: 263
Joined: Sat Jan 14, 2012 2:44 pm

Re: Need a little help DMD and Serial Input

Post by stryker » Mon Sep 08, 2014 3:05 am

coromonadalix wrote:hi
If i play with : Serial.setTimeout(1000); ex: 2000,3000,4000 as values it slow down the response speed / augment the delay to display what i am sending.
Are you trying to do this without hitting enter for each value?

coromonadalix
Posts: 26
Joined: Wed Apr 09, 2014 9:03 pm

Re: Need a little help DMD and Serial Input

Post by coromonadalix » Mon Sep 08, 2014 10:30 pm

each time i recompile with new value, whait for the arduino to reset, send characters, digits ....

sometimes ex: 111111111 passed ok and displayed ok but after that it become 2 first good characters and the last one if i do more than 4 digits / characters

angusgr
Freetronics Staff
Freetronics Staff
Posts: 853
Joined: Tue Apr 09, 2013 11:19 pm
Location: Melbourne, Australia
Contact:

Re: Need a little help DMD and Serial Input

Post by angusgr » Wed Sep 10, 2014 12:48 am

How are you sending the characters to the Arduino? Are you using the built-in "Serial Monitor" feature in the IDE, or something else?

coromonadalix
Posts: 26
Joined: Wed Apr 09, 2014 9:03 pm

Re: Need a little help DMD and Serial Input

Post by coromonadalix » Fri Sep 12, 2014 3:09 am

yes and other serials terminals, the problems are the same ???

Post Reply