how to use this Function With DMD library

The Dot Matrix Display (DMD) is a 32x16 array of high-brightness LEDs for visually striking effects. [Product Page]
Post Reply
m_nagy2
Posts: 13
Joined: Mon Jun 13, 2016 9:22 pm

how to use this Function With DMD library

Post by m_nagy2 » Fri Jul 01, 2016 4:46 pm

the Function :

Code: Select all

void getNextPTime(double &pTime, char* pTimeName)
{
  double times[sizeof(TimeName)/sizeof(char*)];
  double currTime=hour()+minute()/60.0;
  int i;
  
  set_calc_method(ISNA);
  set_asr_method(Shafii);
  set_high_lats_adjust_method(AngleBased);
  set_fajr_angle(15);
  set_isha_angle(15);

  //get_prayer_times(year(), month(), day(), 46.9500, 7.4458, 1, times);
  get_prayer_times(year(), month(), day(), 46.9500, 7.4458, 2, times);
  for (i=0;i<sizeof(times)/sizeof(double);i++){
    if (times[i] >= currTime) break;
  }
  if ( (times[i]-currTime) <0 ) {    
    i=0;
  }
  pTime=times[i];
  sprintf(pTimeName,"%s",TimeName[i]);
}
i use DMD library
code :

Code: Select all

dmd.clearScreen( true );
   dmd.selectFont(Arabic_tahoma);
   const char *MSGg = "~aـizla Brqmla BOrqla rjzla rhxla WOrila rgfla HRarela HGRD ~aSLsla";
   dmd.drawMarquee(MSGg,strlen(MSGg),(32*DISPLAYS_ACROSS)-1,0);
  
   currentMillis = (millis()+5000);  // loop for 5 seconds
   while ( millis() < currentMillis){ 
      dmd.stepMarquee(1,0);
      delay(30);
   }

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

Re: how to use this Function With DMD library

Post by stryker » Fri Jul 01, 2016 10:26 pm

Why do you need to use it? You've copied that straight out of the example provided with the library, yet they don't use it at all and still output every prayer time in the list? Delete that function from the example and it compiles and runs fine.

The prayer times are held in the array times which appears to be populated in the example using the get_prayer_times() function. This means you'll be able to access everything you need from that array, presuming you know which element in the array contains the specific time you're interested in.

After providing a functioning source for the clock values, the prayer times are put in the array using (commented in the example) line

Code: Select all

get_prayer_times(year(), month(), day(), latitude, longitude, dst, times)
Here, the functions year(), month(), and day() are from the time library,

Code: Select all

#include <Time.h>
and the latitude & longitude are provided by you in the code as two float constants, and the timezone in dst as an integer.

You'll need to add the code to run your clock, so that year(), month(), and day() return the actual current time and not default to January 1, 1970 as they do with no time source (which is why the example does that). Hope this makes sense.

Cheers!
Geoff

m_nagy2
Posts: 13
Joined: Mon Jun 13, 2016 9:22 pm

Re: how to use this Function With DMD library

Post by m_nagy2 » Sat Jul 02, 2016 1:47 am

yes i do that in loop and get all prayers times in array

and put If Statement in the getnextprayer Function to the main function

its work good now

but i want to add text to the variable contain next prayer time value
this is variable
const char * MSG = tmp;
i need to add text beside tmp variable

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

Re: how to use this Function With DMD library

Post by stryker » Sat Jul 02, 2016 6:07 am

Please share your code and explain your problem so we can help.

Post Reply