how to Scroll a text in 32x32 dmd matrix

The Dot Matrix Display (DMD) is a 32x16 array of high-brightness LEDs for visually striking effects. [Product Page]
Post Reply
Nekhilesh kumar
Posts:4
Joined:Sat Feb 04, 2017 12:37 pm
how to Scroll a text in 32x32 dmd matrix

Post by Nekhilesh kumar » Sat Feb 04, 2017 1:14 pm

Please help!!

I am current facing the problem with Text scrolling.

i want to scroll a message in 32x32 dmd panel, which contain 2 dmd modules, row wise connected.

How can i connect it to arduino, so both modules get signal and can work as one 32x32 display panel,

do i also need to change font size, so it can be visible much bigger.


changes that i am doing in code are,

#define DISPLAYS_ACROSS 1
#define DISPLAYS_DOWN 2


please see my code:

Code: Select all

#include <SPI.h>        
#include <DMD.h>        
#include <TimerOne.h>   
#include "SystemFont5x7.h"
#include "Arial_Black_16_ISO_8859_1.h"
//Fire up the DMD library as dmd
#define DISPLAYS_ACROSS 1
#define DISPLAYS_DOWN 2
DMD dmd(DISPLAYS_ACROSS, DISPLAYS_DOWN);

int switch2= 2;
int switch3= 3;
int switch4= 4;
int switch5= 5;
boolean Switch=false;

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


boolean debounceSwitch2(boolean last){
  boolean SwitchPin2=digitalRead(switch2);
  if(last!=SwitchPin2){
    delay(5);
    SwitchPin2=digitalRead(switch2);
  }
  return SwitchPin2;
}

boolean debounceSwitch3(boolean last){
  boolean SwitchPin3=digitalRead(switch3);
  if(last!=SwitchPin3){
    delay(5);
    SwitchPin3=digitalRead(switch3);
  }
  return SwitchPin3;
}

boolean debounceSwitch4(boolean last){
  boolean SwitchPin4=digitalRead(switch4);
  if(last!=SwitchPin4){
    delay(5);
    SwitchPin4=digitalRead(switch4);
  }
  return SwitchPin4;
}


boolean debounceSwitch5(boolean last){
  boolean SwitchPin5=digitalRead(switch5);
  if(last!=SwitchPin5){
    delay(5);
    SwitchPin5=digitalRead(switch5);
  }
  return SwitchPin5;
}


void setup(void)
{
  pinMode(switch2,INPUT);
  pinMode(switch3,INPUT);
  pinMode(switch4,INPUT);
  pinMode(switch5,INPUT);
   
 Timer1.initialize( 3000 );           
 Timer1.attachInterrupt( ScanDMD );   

   
 dmd.clearScreen( true );  
 Serial.begin(9600);
}


void loop(void)
{
   dmd.clearScreen( true );
   dmd.selectFont(Arial_Black_16_ISO_8859_1);

    char *MSG1 = "One";
   char *MSG2 = "Two";
    char *MSG3 = "Three";
   char *MSG4 = "Four";


boolean SwitchPin2_bool=debounceSwitch2(Switch);
boolean SwitchPin3_bool=debounceSwitch3(Switch);
boolean SwitchPin4_bool=debounceSwitch4(Switch);
boolean SwitchPin5_bool=debounceSwitch5(Switch);


   if(SwitchPin2_bool==true)
  {
  dmd.drawMarquee(MSG1,strlen(MSG2),(32*DISPLAYS_ACROSS)-1,0);
  }
  else if(SwitchPin3_bool==true){
   dmd.drawMarquee(MSG2,strlen(MSG2),(32*DISPLAYS_ACROSS)-1,0);
  }
 else if(SwitchPin4_bool==true){
   dmd.drawMarquee(MSG3,strlen(MSG3),(32*DISPLAYS_ACROSS)-1,0);
  }
else{
 dmd.drawMarquee(MSG4,strlen(MSG4),(32*DISPLAYS_ACROSS)-1,0);
}
 

   
   long start=millis();
   long timer=start;
   while(1){
     if ((timer+30) < millis()) {
       dmd.stepMarquee(-1,0);
       timer=millis();
     }
   }
}

Please Help!!
Last edited by Nekhilesh kumar on Mon Feb 06, 2017 5:41 pm, edited 4 times in total.

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

Re: Switching problem while using digitalRead, in dmd arduino library

Post by stryker » Sat Feb 04, 2017 9:59 pm

I've not tried your code, but it would be worth checking that the read of the switch is functional which you could do by turning the Arduino D13 LED on and off to echo the switch read, just to ensure your physical circuit is doing its job too.

Also, I'd look at software debouncing the switch (link to youtube video by Jeremy Blum on the subject). A digitalRead() of a switch without some form of debouncing will be unreliable.

Nekhilesh kumar
Posts:4
Joined:Sat Feb 04, 2017 12:37 pm

Re: Switching problem while using digitalRead, in dmd arduino library

Post by Nekhilesh kumar » Sun Feb 05, 2017 5:37 am

thanks for your quick replay,

Now, I want to know, how can i apply debounce to my current code block.( is it possible ).

please help!!

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

Re: Switching problem while using digitalRead, in dmd arduino library

Post by stryker » Sun Feb 05, 2017 7:57 am

The answer is in that video. At around 13mins he creates a function which you can use almost verbatim.

Nekhilesh kumar
Posts:4
Joined:Sat Feb 04, 2017 12:37 pm

Re: Switching problem while using digitalRead, in dmd arduino library

Post by Nekhilesh kumar » Mon Feb 06, 2017 6:09 am

Jeremy Blum debounce function is'nt working for me.

Is there any other solution.

please see my code. "Text_Scroll_dmd.txt"

Thanks,

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

Re: Switching problem while using digitalRead, in dmd arduino library

Post by stryker » Mon Feb 06, 2017 7:01 am

You've not provided an updated version of your code. Also have you done as I suggested and used the Arduino LED on D13 to see if your button press is being registered?

Nekhilesh kumar
Posts:4
Joined:Sat Feb 04, 2017 12:37 pm

Re: how to Scroll a text in 32x32 dmd matrix

Post by Nekhilesh kumar » Mon Feb 06, 2017 5:46 pm

Thanks stryker for your help.

I somehow solved my previous problem,
but now stuck in this one.

please help!!


again,
thanks to stryker for your kind Attention.

hope, u will help me in this one too

Regards,

aprada66
Posts:4
Joined:Sun Jul 30, 2017 3:03 pm

Re: how to Scroll a text in 32x32 dmd matrix

Post by aprada66 » Thu Aug 03, 2017 5:27 pm

Hi:

I have 4 panels, in a 2x2 format... I have the same problem (I need to scroll in one line, but both lines are scrolled) and I think that solution is to modify the library.

I'm checking the library code and I will help you soon.

Regards, APR

Post Reply