exit status 1
'RTClib' does not name a type
#include <SPI.h>
#include <DMD2.h>
#include <fonts/SystemFont5x7.h>
#include <Wire.h>
#include <DS3231.h>
#include <Timer.h>
#include <EEPROM.h>
#include <avr/pgmspace.h>
#define BUZZ 3
// Object Declarations
SoftDMD dmd(2,1); // set the DMD P 10 (2 panjang x 1 lebar)
DMD_TextBox box1(dmd,1,4,62,8); // "box1" runing text first row
RTClib RTC;
DS3231 Clock;
Timer DrawTmr;
//Structure of Variable
struct struct_param // loaded to EEPROM
{
uint8_t state; // 1 byte add 0
float L_LA; // 4 byte add 1
float L_LO; // 4 byte add 5
float L_AL; // 4 byte add 9
float L_TZ; // 4 byte add 13
float IH; // 4 byte add 17
uint8_t MT; // 1 byte add 21 // value 1-masjid 2-mushollah 3-surau 4-langgar
uint8_t BL; // 1 byte add 22
};
struct hijir_date
{
uint8_t hD;
uint8_t hM;
uint16_t hY;
};
// Variable by Structure
struct_param Prm;
hijir_date nowH;
DateTime now;
float floatnow=0;
//Other Variable
float sholatT[7] = {0,0,0,0,0,0,0};
//Timer ID dan run state
int Box1Id = 0;
int Box2Id = 0;
int GregTId = 0;
boolean Box1Run = false;
boolean Box2Run = false;
boolean GregTRun = true;
//Blue tooth Pram Receive
char CH_Prm[155];
boolean Prm_State = false;
//=======================================
// S E T U P
//=======================================
void setup()
{
//init comunications
Serial.begin(9600);
Wire.begin();
// Get Saved Parameter from EEPROM
GetPrm();
// SendPrm();
//Get & Caculate Time Informations
updateTime();
sholatCal();
//init P10 Led Display & Salam
dmd.setBrightness(int(Prm.BL));
dmd.begin();
dmd.selectFont(SystemFont5x7);
dmd.drawString(9,0,"Assalamu");
dmd.drawString(12,9,"Alaikum");
delay(5000);
dmd.clearScreen();
//init all timer fuction (timer.h)
DrawTmr.every(60000,sholatCal);// Calculate sholah time .. every 1 m
}
//=======================================
// M A I N L O O P
//=======================================
void loop()
{
// Check setup comunication
if (Prm_State)
{
LoadPrm();
Prm_State = false;
// SendPrm(); // uncoment for degug purpose
sholatCal();
dmd.setBrightness(int(Prm.BL));
}
// check time
updateTime();
check_time(); //check to for Azzan
if (Box1Run)
{
Box1Run =false;
DrawTmr.stop(Box2Id);
DrawTmr.stop(GregTId);
Box1Id = DrawTmr.every(350,drawBox1);
dmd.clearScreen();
drawBox1();
}
if (Box2Run)
{
Box2Run = false;
DrawTmr.stop(Box1Id);
DrawTmr.stop(GregTId);
Box2Id = DrawTmr.every(4000,drawBox2);
dmd.clearScreen();
drawBox2();
}
if (GregTRun)
{
GregTRun = false;
DrawTmr.stop(Box1Id);
DrawTmr.stop(Box2Id);
GregTId = DrawTmr.every(1000,drawGreg_T);
dmd.clearScreen();
drawGreg_T();
}
DrawTmr.update();
}
void updateTime()
{
now = RTC.now();
floatnow = float(now.hour()) + float(now.minute())/60 + float(now.second())/3600;
}
//------------------------------------------
// Function Iqomah && Azzan
//------------------------------------------
void check_time()
{
boolean jumat = false;
for(uint8_t i=0; i <7; i++)
{
if (not((i == 1) or (i == 2)))
{
if( (floatnow >= (sholatT_)) and (floatnow < (sholatT*+0.02)))_
_ {_
_ pinMode(BUZZ, OUTPUT); _
_ if ((Clock.getDoW() == 6) and (i == 3) and (Prm.MT==1)) {jumat = true;} _
call_azzan(i,jumat);
if(!jumat) {call_iqomah(i);}
call_sholat(i,jumat);
_ dmd.clearScreen(); //Clear Screen bofore back to normal mode*_
* pinMode(BUZZ, INPUT);*
* break;*
* }*
* }*
* }*
* return;*
* }*
void call_azzan(uint8_t i, boolean jumat)
* {*
* uint8_t CtAzn = 0; // boolean jumat = false;
_ char locBuff[15];_
_ int lenBuff;*_
* //Masuk Waktu Sholat (2 detik)*
* dmd.clearScreen();*
* dmd.drawBox(2,2,61,13);*
* dmd.drawString(17,0,"Azzan");*
* if(jumat) {sprintf(locBuff,"Jum'at\0");}*
* else {sprintf(locBuff,"%s\0",sholatN(i));}*
* lenBuff =strlen(locBuff);*
_ lenBuff = (64-(lenBuff6))/2;_
_ dmd.drawString(lenBuff,9,locBuff);_
_ while(CtAzn < 5)_
_ {_
_ analogWrite(BUZZ, 50);_
_ delay(300);_
_ analogWrite(BUZZ, 0); _
_ delay(300);_
_ CtAzn ++;_
_ }_
_ delay(120000); //wait 2 minutes*_
* }*
void call_iqomah(uint8_t i) // Countdown Iqomah (9 menit)
* { *
* uint8_t menit = 0;
uint8_t detik = 0;
_ char locBuff[6];*_
* dmd.clearScreen();*
* dmd.drawBox(2,2,61,13);*
* dmd.drawString(5,9,"ke Iqomah"); *
* for (int16_t x = 540; x > 0 ;x --)
_ {_
_ menit = floor(x/60);detik = fmod(x,60);_
_ sprintf(locBuff,"%02d.%02d mnt\0",menit,detik);_
_ dmd.drawString(6,0,locBuff);_
_ delay(1000); _
_ }_
_ }_
void call_sholat(uint8_t i, boolean jumat)
_ {_
_ // Sedang Sholat mati kan display*_
* dmd.clearScreen();*
* dmd.drawBox(2,2,61,13);*
* dmd.drawString(5,0,"Mari Kita");*
* dmd.drawString(14,9,"Sholat");*
* analogWrite(BUZZ, 50);*
* delay(500);*
* analogWrite(BUZZ, 0);*
* delay(30000);*
* dmd.clearScreen();*
* int tunggu=0;*
* if(jumat) {tunggu=900;}*
* else {tunggu = 600;}*
* for (int i =tunggu ;i > 0; i--)*
* {*
* dmd.drawBox(61,13,62,14);*
* delay(500);*
* dmd.clearScreen();*
* delay(500);*
* }*
* }*
//------------------------------------------
*// Function Drawing Content *
//------------------------------------------
void drawBox1() //box Info
* {*
* dmd.drawLine(2,2,61,2);*
* dmd.drawLine(2,13,61,13);*
* // Variable Box 1*
* uint8_t static Box1St;
uint8_t static Box1Ln;
_ int static Box1Ct;_
_ char static Box1Buff[150];*_
* if(Box1Ct==0)*
* {*
* switch(Box1St)*
* {*
* case 0: // Get Masjid Name*
* drawMasjidName(Box1Buff);*
* break;*
* case 1 : // Get Hijjir Date*
* drawHijrDayDate(Box1Buff);*
* break;*
* case 2: // Get Note 1*
// get_puasa(Box1Buff);
if(get_puasa(Box1Buff)){}
* else {EEPROM.get(80, Box1Buff);}*
* break;*
* case 3: // Get Note 2*
* EEPROM.get(230, Box1Buff);*
* break;*
* case 4: // Get Note 3*
* EEPROM.get(380, Box1Buff);*
* break;*
* }*
* Box1Ln = strlen(Box1Buff);*
* if (Box1St >= 4) {Box1St = 0; }*
* else {Box1St ++;}*
* box1.clear();*
* box1.reset();*
* box1.print(" ");*
* }*
* if(Box1Ct >= Box1Ln)*
* { box1.print(" ");}*
* else*
* {box1.print(Box1Buff[Box1Ct]);};*
* Box1Ct ++;*
* if(Box1Ct >= Box1Ln+11) {Box1Ct = 0;}*
* if((Box1Ct ==0)and(Box1St ==0)) {Box2Run = true;}*
* }*
void drawBox2() // Box Sholah Time
* {*
* // Variable Box 2*
* uint8_t static Box2St;
_ char locBuff[35];_
_ sprintf(locBuff,"%s\0",sholatN(Box2St));_
_ int lenBuff = strlen(locBuff);_
_ lenBuff = (64-lenBuff6)/2;
* float stime = sholatT[Box2St];*
* uint8_t shour = floor(stime);
uint8_t sminute = floor((stime-shour)60);
_ dmd.clearScreen();
* dmd.drawBox(2,2,61,13);*
* dmd.drawString(lenBuff,0,locBuff,GRAPHICS_ON,System5x7);
_ sprintf(locBuff,"%02d.%02d\0",shour,sminute);_
dmd.drawString(17,9,locBuff,GRAPHICS_ON,System5x7);
_ if (Box2St > 6) {Box2St = 0 ; GregTRun= true;}_
_ else {Box2St ++;} _
_ }_
void drawGreg_T()
_ {_
uint8_t static GregTSt;
_ char locBuff[20];_
_ //Draw Date*_
* sprintf(locBuff,"%02d\0",now.day());*
* dmd.drawString(1,0,locBuff,GRAPHICS_ON,System5x7);
_ sprintf(locBuff,"%04d\0",now.year());_
dmd.drawString(40,0,locBuff,GRAPHICS_ON,System5x7);
dmd.drawString(18,0,MonthName(now.month()),GRAPHICS_ON,System5x7);*
* // Draw Time*
* sprintf(locBuff,"%02d:%02d:%02d\0",now.hour(),now.minute(),now.second());*
* dmd.drawString(8,9,locBuff,GRAPHICS_ON,System5x7);
_ if (GregTSt>=30) {GregTSt = 0;Box1Run = true;}_
_ else {GregTSt++;}_
_ }*_