Go Down

Topic: Trick for 16-rows display using Parola :) (Read 8548 times) previous topic - next topic

marco_c

Quote
So i am asking the Gurus if I can get any animation using the above lines?
The answer is yes to both (assuming the string is correct). You will need to call displayAnimate() from inside the loop() function every time through the loop or it will not animate properly. This is how it is done in the examples, so look at them for reference.
Arduino Libraries https://github.com/MajicDesigns?tab=Repositories
Parola for Arduino https://github.com/MajicDesigns/Parola
Arduino++ blog https://arduinoplusplus.wordpress.com

vijithcv

The answer is yes to both (assuming the string is correct). You will need to call displayAnimate() from inside the loop() function every time through the loop or it will not animate properly. This is how it is done in the examples, so look at them for reference.
I am at dead end !

Getting error as " no matching function for call to 'MD_Parola::displayText(char [15], textPosition_t, int, int)'"

Sorry I am not getting the idea to move forward !

Code: [Select]


#include <Wire.h>
#include <MD_DS1307.h>
#include <MD_Parola.h>
#include <MD_MAX72xx.h>
#include <SPI.h>
#include <RTClib.h>


#define MAX_DEVICES 4
#define CLK_PIN   13
#define DATA_PIN  11
#define CS_PIN    10

#define SPEED_TIME  100
#define PAUSE_TIME  10



RTC_DS1307 rtc;

MD_Parola P = MD_Parola(DATA_PIN, CLK_PIN, CS_PIN, MAX_DEVICES);
//MD_Parola P = MD_Parola(CS_PIN, MAX_DEVICES);

void setup ()
{

  Wire.begin();
  Serial.begin(57600);
  P.begin();
  

  
 if(! rtc.begin())
  {
    Serial.println("Couldn't find RTC");
    while (1);
  }

 if(! rtc.isrunning())
  {
    Serial.println("RTC is NOT running!");
    // following line sets the RTC to the date & time this sketch was compiled
     rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
    
  }

}
void loop ()

{

 

DateTime now = rtc.now();
    


char timeStamp[15];
char dateStamp[15];

  

sprintf(timeStamp, "%3.2d:%02d", now.hour() ,now.minute());



Serial.println(timeStamp);

    
sprintf(dateStamp, "%3.2d/%02d",  now.day(),now.month());  
  
Serial.println(dateStamp);

 
P.print(timeStamp);



 P.displayText(timeStamp, PA_CENTER, SPEED_TIME, PAUSE_TIME);

  
    P.displayAnimate();

}






marco_c

Here is the manual entry from the documentation, which I am pretty sure you may not have read. It is located in the docs subfolder of the library and is also online where you got the library from)
Code: [Select]
void displayText (char *pText, textPosition_t align, uint16_t speed, uint16_t pause, textEffect_t effectIn, textEffect_t effectOut=PA_NO_EFFECT)
Here is your function call
Code: [Select]
P.displayText(timeStamp, PA_CENTER, SPEED_TIME, PAUSE_TIME);
Where is the effectIn parameter in your call?

I realise this is probably new to you and English may not be your first language, but if you don't know what you are doing it is ALWAYS best to start from a working example (and there are many for this library), and make gradual changes so that you know the last change was the one that caused whatever error you are getting.

As I also said before, look at the structure of the loop() in the examples. It is nothing like you have written and I am sure that yours will not as it is.
Arduino Libraries https://github.com/MajicDesigns?tab=Repositories
Parola for Arduino https://github.com/MajicDesigns/Parola
Arduino++ blog https://arduinoplusplus.wordpress.com

vijithcv

I realise this is probably new to you and English may not be your first language, but if you don't know what you are doing it is ALWAYS best to start from a working example
I am sorry I am an Electrical Engineer by profession and I am new to programming. I am trying to understand this ocean with bits and pieces which I have studied in college . This is more like a hobby learning to me in my free time. So please excuse my questions and ignorance in this field.

Now my main difficulty in understanding is how can I get to print my result which is stored in char timeStamp[].

Code: [Select]


sprintf(timeStamp, "%3.2d:%02d", now.hour() ,now.minute());



Serial.println(timeStamp);

   
sprintf(dateStamp, "%3.2d/%02d",  now.day(),now.month());   
 
Serial.println(dateStamp);

 
P.print(timeStamp);



I would make myself clear with the below extract code from your example code in "Parola Ambulance"
Code: [Select]


char *msg[] =
{
  "Ambulance",
  "Emergency",
};




The animation starts from the below code I guess

Code: [Select]


  P.displayText(msg[cycle], PA_CENTER, SCROLL_SPEED, PAUSE_TIME, PA_PRINT, PA_NO_EFFECT);



"msg" means the char "Ambulance Emergency"

Whereas in my program the word to be animated is timeStamp which itself is an array having some data in it.

So how can I display the text inside timeStamp array like you have done by printing out the msg[] , ie, "Ambulance Emergency" which is a word and not a data like TIME.

 :smiley-confuse:

marco_c

Parola does not care what is in the message. It just prints characters. You just need to specify what you want to display by passing the character buffer to the library. In the examples it is mostly static text as this is the easiest for demo purposes. You have a more dynamic message. No difference.
Arduino Libraries https://github.com/MajicDesigns?tab=Repositories
Parola for Arduino https://github.com/MajicDesigns/Parola
Arduino++ blog https://arduinoplusplus.wordpress.com

vijithcv

You have a more dynamic message. No difference.
Could you please suggest a method of passing a dynamic message into a char. I mean how can I declare my char timeStamp into a static one so that I can utilize it as a string or word which can be printed out.

P.displayText(timeStamp, ....

won't work because I tried. Is there any other way like changing the char timeStamp[] into a word or string?

marco_c

Time stamp should already be an array of characters or sprintf() and print() will not work.
Arduino Libraries https://github.com/MajicDesigns?tab=Repositories
Parola for Arduino https://github.com/MajicDesigns/Parola
Arduino++ blog https://arduinoplusplus.wordpress.com

vijithcv

Time stamp should already be an array of characters or sprintf() and print() will not work.
Atlast I managed to scroll the time. Thanks for the guidance.

But after every scroll_left of time, the date flashes and again scrolling of time continues.

Code: [Select]


#include <Wire.h>
#include <MD_DS1307.h>
#include <MD_Parola.h>
#include <MD_MAX72xx.h>
#include <SPI.h>
#include <RTClib.h>


#define MAX_DEVICES 4
#define CLK_PIN   13
#define DATA_PIN  11
#define CS_PIN    10


#define MAX_DEVICES 4

#define PAUSE_TIME    3000
#define SCROLL_SPEED  30


RTC_DS1307 rtc;

//MD_Parola P = MD_Parola(DATA_PIN, CLK_PIN, CS_PIN, MAX_DEVICES);
MD_Parola P = MD_Parola(CS_PIN, MAX_DEVICES);

void setup ()
{

  Wire.begin();
  Serial.begin(57600);
  P.begin();
  
 if(! rtc.begin())
  {
    Serial.println("Couldn't find RTC");
    while (1);
  }

 if(! rtc.isrunning())
  {
    Serial.println("RTC is NOT running!");
    // following line sets the RTC to the date & time this sketch was compiled
     rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
    
  }

}
void loop ()

{

DateTime now = rtc.now();
    
char timeStamp[15];
char dateStamp[15];

sprintf(timeStamp, "%d:%d", now.hour() ,now.minute());

Serial.println(timeStamp);
    
sprintf(dateStamp, "%d/%d",  now.day(),now.month());  
  
Serial.println(dateStamp);


 for (uint8_t i=0; i<ARRAY_SIZE(timeStamp); i++)
 
    {

       P.displayText(timeStamp, PA_CENTER, SCROLL_SPEED, PAUSE_TIME, PA_PRINT, PA_SCROLL_LEFT);
  
    
      while (!P.displayAnimate())
      
      ;
    
      break;
      
    }


P.print(dateStamp);

}




The looping continues with flashing date after every scroll_left.

I am planning to scroll the date after the timeloop finishes.

vijithcv

Atlast I managed to scroll the time. Thanks for the guidance.

The looping continues with flashing date after every scroll_left.

I am planning to scroll the date after the timeloop finishes.
Atlast this is what I came up with. Please let me know if I can simplify the program. But anyhow it works. Hope new year will become 01/01/2018  ;)

Code: [Select]


#include <Wire.h>
#include <MD_DS1307.h>
#include <MD_Parola.h>
#include <MD_MAX72xx.h>
#include <SPI.h>
#include <RTClib.h>


#define MAX_DEVICES 4
#define CLK_PIN   13
#define DATA_PIN  11
#define CS_PIN    10


#define MAX_DEVICES 4

#define PAUSE_TIME    3000
#define SCROLL_SPEED  30


RTC_DS1307 rtc;

//MD_Parola P = MD_Parola(DATA_PIN, CLK_PIN, CS_PIN, MAX_DEVICES);
MD_Parola P = MD_Parola(CS_PIN, MAX_DEVICES);

void setup ()
{

  Wire.begin();
  Serial.begin(57600);
  P.begin();
 
 if(! rtc.begin())
  {
    Serial.println("Couldn't find RTC");
    while (1);
  }

 if(! rtc.isrunning())
  {
    Serial.println("RTC is NOT running!");
    // following line sets the RTC to the date & time this sketch was compiled
     rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
   
  }

}
void loop ()

{

DateTime now = rtc.now();
     
char timeStamp[15];
char dateStamp[15];



sprintf(timeStamp, "%02d:%02d", now.hour() ,now.minute());

Serial.println(timeStamp);
   
sprintf(dateStamp, "%02d/%02d",  now.day(),now.month());   
 
Serial.println(dateStamp);



 for (uint8_t i=0; i<ARRAY_SIZE(timeStamp); i++)
 
    {
P.displayText(timeStamp, PA_CENTER, SCROLL_SPEED, PAUSE_TIME, PA_PRINT, PA_MESH);
P.displayAnimate();

 while (!P.displayAnimate())
     
      ;
   
      break;
     
    }
   
 for (uint8_t q=0; q<ARRAY_SIZE(timeStamp); q++)
 
    {



 int dow = now.dayOfTheWeek();               
 char *d   ;                         
  switch(dow)
  {
     case 1:
     Serial.println("MON");
     d = "MON";
   
     break;
     
     case 2:
     Serial.println("TUE");
   
    d = "TUE";
 
     break;
     case 3:
     
     Serial.println("WED");
     

  d = "WED";
 
     break;
     case 4:
     
     Serial.println("THU");
     
    d = "THU";
   
     break;
     case 5:
     
     Serial.println("FRI");
     
   d = "FRI";
   
     break;
     case 6:
   Serial.println("SAT");
 
   d = "SAT";
   
     break;
     case 0:
     
     Serial.println("SUN");
     
   d = "SUN";
     break;
     }
   

P.displayText(d, PA_CENTER, SCROLL_SPEED, PAUSE_TIME, PA_PRINT, PA_BLINDS);
P.displayAnimate();

 while (!P.displayAnimate())
     
      ;
   
      break;
     
    }



for (uint8_t j=0; j<ARRAY_SIZE(dateStamp); j++)
{

 P.displayText(dateStamp, PA_CENTER, SCROLL_SPEED, PAUSE_TIME, PA_PRINT, PA_SCROLL_LEFT);
   
     
      while (!P.displayAnimate())
     
      ;
   
      break;
     
    }


for (uint8_t r=0; r<ARRAY_SIZE(dateStamp); r++)
 
    {


 int moy = now.month();               
 char *e   ;   
                     
  switch(moy)
  {
     case 1:
     Serial.println("JAN");
    e = "JAN";
   
     break;
     
     case 2:
     Serial.println("FEB");
   
   e = "FEB";
 
     break;

     case 3:
     
     Serial.println("MAR");
     

  e = "MAR";
 
     break;

     case 4:
     
     Serial.println("APR");
     
    e = "APR";
   
     break;

     case 5:
     
     Serial.println("MAY");
     
   e = "MAY";
   
     break;


     case 6:
   Serial.println("JUN");
 
   e = "JUN";
   
     break;

     case 7:
     
     Serial.println("JUL");
     
   e = "JUL";
     break;


case 8:
     
     Serial.println("AUG");
     
   e = "AUG";
     break;

case 9:
     
     Serial.println("SEP");
     
   e = "SEP";
     break;

case 10:
     
     Serial.println("OCT");
     
   e = "OCT";
     break;

case 11:
     
     Serial.println("NOV");
     
   e = "NOV";
     break;

case 12:
     
     Serial.println("DEC");
     
   e = "DEC";
     break;

     }
   

P.displayText(e, PA_CENTER, SCROLL_SPEED, PAUSE_TIME, PA_PRINT, PA_SCAN_HORIZ);
P.displayAnimate();

 while (!P.displayAnimate())
     
      ;
   
      break;
     
    }

 
for (uint8_t k=0; k<ARRAY_SIZE(dateStamp); k++)
{
  int iVarToCast = now.year();
  char buffer[4];
  dtostrf(iVarToCast, 4, 0, buffer);
 

P.displayText(buffer, PA_CENTER, SCROLL_SPEED, PAUSE_TIME, PA_PRINT, PA_SCROLL_LEFT);
Serial.println(buffer);

 while (!P.displayAnimate())
     
      ;
   
      break;
     
    }
}





vijithcv

Atlast this is what I came up with. Please let me know if I can simplify the program. But anyhow it works. Hope new year will become 01/01/2018  ;)

Everything works except two issues.

1) The Week and Month name is clipped if I use the scroll function. Eg: It shows only Januar and while it scrolls it doesn't display the remaining.

2) The seconds doesn't increment while I enable the Parola scroll or any other animation. Its like the current second is saved in the char array and its displaying that value at that instant only.

I added a LM35 Sensor and I face the same issue wherein the temperature is not displayed real time. If there is any increase in temperature its displayed in the next animation sequence. Its also like frozen.

I think when the value is put into a char array and while using Parola library it shows the value as a word and any change in the value is shown in the next cycle of animation.

I hope i made my problem little bit clear.

Anyway it keeps the time and temperature day and date properly. Only minus I am not getting a live display.

sankaramp

nyc work sir....i'm also trying lyk this...
Total 32 (8x8)matrices taken as 2 zones.....
0-15  Bottom zone,
16-31 TopZone.

Here my problem is the two zones are not synchronized eachother...When i increse the scrolling speed,the bottom zone move forward than upperzone...they not synchronized..
please help me...
give me suggetions...

thanq,
Sankar.

gokulasgk

Hello, I am getting error that 'CENTER' is not declared in the scope. Please help me. My matrix display is 16 (height) x 64 (length). Please help me with coding.

marco_c

Seriously?

Code: [Select]
enum textPosition_t
{
  PA_LEFT,    ///< The leftmost column for the first character will be on the left side of the display
  PA_CENTER,  ///< The text will be placed with equal number of blank display columns either side
  PA_RIGHT    ///< The rightmost column of the last character will be on the right side of the display
};

Please read the documentation supplied with the library and/or the header files. We will all find it less frustrating.
Arduino Libraries https://github.com/MajicDesigns?tab=Repositories
Parola for Arduino https://github.com/MajicDesigns/Parola
Arduino++ blog https://arduinoplusplus.wordpress.com

Go Up