Pada artikel kali ini saya akan berbagi cara memperbaiki JWS 7 Segment yang rusak karena disambar petir. Setelah tersambar petir, JWS 7 Segment kondisinya:
- Display menampilkan karakter acak-acakan
- Buzzer tidak berhenti berbunyi / selalu berbunyi
Setelah saya cek, ternyata kerusakannya ada pada mikrokontroler nya. Mungkin mikrokontroler tersebut rusak secara hardware, atau hanya sekedar rusak programnya saja (harus di flashing / program ulang). Dikarenakan saya tidak mengetahui Jam Sholat JWS ini menggunakan vendor mana, sehingga saya tidak bisa sembarang membeli kontroler JWS 7 Segment yang dijual secara online, sebab jika salah beli maka saya bisa rugi lumayan besar, disebabkan harga kontrolernya yang tidak murah.
Oleh sebab itu, saya harus mempelajari hardware dari JWS 7 Segment itu sendiri, kemudian memrakit dan memprogram sendiri kontroler JWS yang sesuai dengan hardware yang sedang saya perbaiki. Setelah melakukan beberapa tahap identifikasi, observasi, dan beberapa pertimbangan, akhirnya saya memutuskan untuk menggunakan Arduino Uno R3, RTC DS3231, Buzzer 12A05 (bawaan dari vendornya) (krn Buzzer ini suaranya jernih dan nyaring, bukan abal-abal), Remote TV Universal, Kanibal IR Receiver Sensor dari MP3 Player bekas, Rangkaian Power Supply bawaan vendor, dan melakukan modifikasi JWS 7 Segement Simple dari Fans Electronic.
Alhamdulillah, hasilnya cukup memuaskan. Jam Sholat Digital / JWS 7 Segment bisa menyala kembali, menampilkan waktu dengan presisi, menampilkan jadwal sholat dengan baik, bisa disetting secara remote menggunakan remote tv universal, style tampilan yang lebih update karena menggunakan kode program lebih baru.
Untuk mengetahui step-step yang dilakukan dalam perbaikan ini bisa disaksikan pada video berikut ini:
Part 1: https://youtu.be/DI4PCLy1oSc Memperbaiki Jam Masjid JWS Seven Segment Part 1 : (Identifikasi Hardware, Modul & Tes Kode Program) Part 2: https://youtu.be/6G7ux164pw8 Memperbaiki Jam Masjid JWS Seven Segment Part 2 : (Modif Sketch & Menampilkan Jam Pada Display) Part 3: https://youtu.be/pQtUCkhciO4 Memperbaiki Jam Masjid JWS Seven Segment Part 3 : (Menampilkan Waktu Sholat & Jam Pada Display) Part 4: https://youtu.be/XC14J05yoUo Memperbaiki Jam Masjid JWS Seven Segment Part 4 : (Remote TV Untuk Setting JWS) Part 5: https://youtu.be/nKqjrZADUco Memperbaiki Jam Masjid JWS Seven Segment Part 5 : (Trik Dumping Data IR Remote Dengan Mudah & Cepat) Part 6: https://youtu.be/593fN5q_7ls Memperbaiki Jam Masjid JWS Seven Segment Part 6: (Setting Jam - JWS Digital 7 Segment)
SHORT VIDEO
Untuk kode program hasil modifikasi, belum terlalu rapi dan tidak begitu terstruktur, namun cukup untuk menjalankan hardware JWS 7 Segement yang rusak tersambar petir ini. Sebagaimana dari sumber aslinya, yaitu fanselectronics.com, digunakan 4 sketch yang disimpan dalam satu folder, yaitu "JWS_Ekonomis_Set_Remote", "Display", "Jadwal_Sholat", "Setting". Adapun kode programnya adalah sebagai berikut.
JWS_Ekonomis_Set_Remote:
#include <EEPROM.h> //================================================================================================================== // Program ini dibuat dengan tujuan amal, 100% digratiskan untuk membuat Jadwal Waktu Sholat. // Program mendukung pelestarian Masjid diseluruh dunia khususnya Indonesia ataupun sarana pendidikan. // Bagi anda yg mengunduh dan program ini disarankan untuk tidak menghapus catatan yg ada didalamnya. // Bagi anda yang ingin menjual belikan Program ini diwajibkan membayar royalty sebesar 2.5% kepada pembuat. // Dana dapat anda masukan pada kota amal masjid yg ada disekitar anda atau anda dapat mendonasikan kepada // kami sebagai dana untuk membuat JWS di masjid sekitar kami atau pengembangan produk Open Source lainnya. //================================================================================================================== // Catatan & Program ditulis oleh: // Nama : Irfan Indra Kurniawan // Organisasi : Fans Electronics // Website : www.fanselectronics.com // Email : info@fanselectronics.com // GitHub : github.com/FansElectronics // // Project : Jadwal Waktu Sholat Sederhana 1" Segment + Remote TV Setting // Version : V1.2.1 // Dibuat : 1 Februari 2018 // Modif : 20 Oktober 2019 //================================================================================================================== #include <Timer.h> #include <RTClib.h> #include <PrayerTimes.h> #include <IRremote.h> #include <avr/eeprom.h> //================================================================================================================== #define Data2 A3 #define Clock2 9 #define Latch2 8 #define Data A1 #define Clock 7 #define Latch 6 #define ledBlink 13 //A0 #define IR 11 #define buzzer 12 //1 #define mp3_rx 0 #define mp3_tx A2 #define bUP 2 #define bOK 3 #define bDN 4 #define ON LOW //HIGH #define OFF HIGH //LOW //================================================================================================================== byte jedaAdzan = 3; // Waktu adzan (Menit) byte jedaIqomah[] = {3, 5, 5, 5, 5}; // Waktu tunggu iqomah (Menit) >> {subuh,dhuhur,ashar,maghrib,isya} byte jedaMati = 5; // Waktu mati sholat (Menit) byte jedaJumat = 60; // Waktu mati Jumat (Menit) byte selisihWaktu = 0; //2; // Selisi waktu sholat (Menit) float lintang = -0.05; //-0.00; // Latitude -0.003163979364603919, 109.29035596348098 float bujur = 109.19; //109.29; // Longitude byte zonaWaktu = 7; // Zona Waktu //================================================================================================================== int yr = 0; //q8 q7 q6 q5 q4 q3 q2 q1 --> MSB First //byte lowChar[] = { B10000001, B10110111, B11000010, B10010010, B10110100, B10011000, //0,1,2,3,4,5 // B10001000, B10110011, B10000000, B10010000, B11111111, B11111110 //6,7,8,9,all off, g segment // }; //pemetaan shift register JWS Sei. Kakap, DIGIT kecil / sedang //q1 q2 q3 q4 q5 q6 q7 q8 --> LSB First //byte satu = B11011110; // bc >> q3,q8 //byte dua = B00110100; // abdeg >> q7,q8,q2,q1,q5 //byte tiga = B10010100; // abcdg >> q7,q8,q3,q2,q5 //byte empat = B11010010; // bcfg >> q8,q3,q6,q5 //byte lima = B10010001; // acdfg >> q7,q3,q2,q6,q5 //byte enam = B00010001; // acdefg >> q7,q3,q2,q1,q6,q5 //byte tujuh = B11011100; // abc >> q7,q8,q3 //byte delapan = B00010000; // abcdefg >> q7,q8,q3,q2,q1,q6,q5 //byte sembilan = B10010000; // abcdfg >> q7,q8,q3,q2,q6,q5 //byte nol = B00011000; // abcdef >> q7,q8,q3,q2,q1,q6 //byte offDisp = B11111111; //byte onDisp = B00000000; //pemetaan shift register JWS Sei. Kakap, DIGIT besar //Digit Besar, Q5 = Not Connected //byte satuDB = B00010001; // bc >> q4,q8 //byte duaDB = B11101011; // abdeg >> q7,q8,q2,q1,q3,q5 //byte tigaDB = B01111011; // abcdg >> q7,q8,q3,q2,q5 //byte empatDB = B00111101; // bcfg >> q8,q3,q6,q5,q4 //byte limaDB = B01111110; // acdfg >> q7,q4,q3,q2,q6,q5 //byte enamDB = B11111110; // acdefg >> q7,q4,q3,q2,q1,q6,q5 //byte tujuhDB = B00010011; // abc >> q7,q8,q4 //byte delapanDB = B11111111; // abcdefg >> q7,q8,q3,q2,q1,q6,q5 //byte sembilanDB = B01111111; // abcdfg >> q7,q8,q3,q2,q6,q5 //byte nolDB = B11011111; // abcdef >> q7,q8,q3,q2,q4,q6 //byte offDispDB = B00000000; //byte onDispDB = B11111111; byte lowChar[] = { B00011000, B01111011, B00101100, B00101001, B01001011, B10001001, //Modifikasi kode pertamapada lowchar dan pembalikan bit2 agar menjadi MSB , penyesuaian dengan hardware JWS sei. kakap //B10001000, B00111011, B00001000, B00001001, B11111111, B11111110 B10001000, B00111011, B00001000, B00001001, B11111111, B11101111 //B00000000 //untuk digit kecil }; byte lowChar2[] = { B11111011, B10001000, B11010111, B11011110, B10111100, B01111110, //Modifikasi kode pertama pada lowchar dan pembalikan bit2 agar menjadi MSB, penyesuaian dengan hardware JWS sei. kakap //B01111111, B11001000, B11111111, B11111110, B00000000, B00000001 B01111111, B11001000, B11111111, B11111110, B00000000, B11111111 //untuk digit besar }; byte lowCharPoint[] = { //B00000001, B00110111, B01000010, B00010010, B00110100, B00011000, //B00001000, B00110011, B00000000, B00010000, B01111111, B01111110 B00010000, B01110011, B00100100, B00100001, B01000011, B10000001, B10000000, B00110011, B00000000, B00000001, B11110111, B11101111 //B00000000 //untuk digit kecil }; //byte textChar[] = { B10100000, B10110111, B10000101, B10001111, B11001000, B10000001, B10001110, //A,I,U,u,E,O,o // B10000111, B11001101, B10100001, B10101110, B10100100, B10101100, B10010100, //J,L,N,n,H,h,Y // B11001100, B11000010, B11101001, B11001000, B10000110, B10011000, B10010000, //t,Z,r,b,d,S,g // B11110111, B11100000, B11100001, B10110001 //',P,M2,M1 // }; byte textChar[] = { B00001010, B01111011, B01011000, B11111000, B10001100, B00011000, B11101000, //A,I,U,u,E,O,o //Digit Kecil B01111000, B11011100, B00011010, B11101010, B01001010, B11001010, B01001001, //J,L,N,n,H,h,Y B11001100, B00101100, B10011110, B11001000, B01101000, B10001001, B00001001, //t,Z,r,b,d,S,g B01111111, B00001110, B00011110, B00011011 //',P,M2,M1 }; byte textChar2[] = { B11111101, B10001000, B10101011, B00001011, B01100111, B11101011, B00001111, //A,I,U,u,E,O,o //Digit Besar B10001011, B00100011, B11101001, B00001101, B10100101, B00101101, B10101110, //J,L,N,n,H,h,Y B00100111, B11000111, B01100001, B10001100, B10001111, B01101110, B11101110, //t,Z,r,b,d,S,g B10000000, B11100101, B11100001, B11101000 //',P,M2,M1 }; byte ledJWS[] = { B00111110, B00111101, B00111011, B00110111, B00101111, B00011111, B00111111, B11111111}; //imsaq, shubuh, dhuhur, ashar, maghrib, isya', dot tgl dan titik dua time, all led dan 7 segment off /* * case 'A': shiftOut(Data, Clock, MSBFIRST, textChar[0]); break; case 'I': shiftOut(Data, Clock, MSBFIRST, textChar[1]); break; case 'U': shiftOut(Data, Clock, MSBFIRST, textChar[2]); break; case 'u': shiftOut(Data, Clock, MSBFIRST, textChar[3]); break; case 'E': shiftOut(Data, Clock, MSBFIRST, textChar[4]); break; case 'O': shiftOut(Data, Clock, MSBFIRST, textChar[5]); break; case 'o': shiftOut(Data, Clock, MSBFIRST, textChar[6]); break; case 'J': shiftOut(Data, Clock, MSBFIRST, textChar[7]); break; case 'L': shiftOut(Data, Clock, MSBFIRST, textChar[8]); break; case 'N': shiftOut(Data, Clock, MSBFIRST, textChar[9]); break; case 'n': shiftOut(Data, Clock, MSBFIRST, textChar[10]); break; case 'H': shiftOut(Data, Clock, MSBFIRST, textChar[11]); break; case 'h': shiftOut(Data, Clock, MSBFIRST, textChar[12]); break; case 'Y': shiftOut(Data, Clock, MSBFIRST, textChar[13]); break; case 't': shiftOut(Data, Clock, MSBFIRST, textChar[14]); break; case 'Z': shiftOut(Data, Clock, MSBFIRST, textChar[15]); break; case 'r': shiftOut(Data, Clock, MSBFIRST, textChar[16]); break; case 'b': shiftOut(Data, Clock, MSBFIRST, textChar[17]); break; case 'd': shiftOut(Data, Clock, MSBFIRST, textChar[18]); break; case 'S': shiftOut(Data, Clock, MSBFIRST, textChar[19]); break; case 'g': shiftOut(Data, Clock, MSBFIRST, textChar[20]); break; case '`': shiftOut(Data, Clock, MSBFIRST, textChar[21]); break; case 'P': shiftOut(Data, Clock, MSBFIRST, textChar[22]); break; case 'M': shiftOut(Data, Clock, MSBFIRST, textChar[24]); shiftOut(Data, Clock, MSBFIRST, textChar[23]); */ char Key, charBuffer[10], floatBuff[4]; double times[sizeof(TimeName) / sizeof(char*)]; long val; byte i, r, v, e, a, n; int jamSholat, mntSholat, jam, mnt, dtk, tgl, bln , thn, ttk, tDtk, mntTunggu; byte ratusanribu, puluhanribu, ribuan, ratusan, puluhan, satuan; bool setting = false; bool standby = false; bool access = false; bool adzan = false; bool titik = false; //================================================================================================================== RTC_DS3231 rtc; IRrecv remote(IR); decode_results valRemote; Timer tBlink, tMain, tStandBy, tHold; //================================================================================================================== void setup() { Serial.begin(9600); rtc.begin(); remote.enableIRIn(); set_calc_method(ISNA); // Methode perhitungan mengikuti ISNA set_asr_method(Shafii); // Pendapat Imam Syafi'i set_high_lats_adjust_method(AngleBased); set_fajr_angle(20); // Sudut Waktu Subuh set_isha_angle(18); // Sudut Waktu Isya pinMode(Data, OUTPUT); pinMode(Clock, OUTPUT); pinMode(Latch, OUTPUT); pinMode(ledBlink, OUTPUT); pinMode(buzzer, OUTPUT); pinMode(Data2, OUTPUT); pinMode(Clock2, OUTPUT); pinMode(Latch2, OUTPUT); tBlink.oscillate(ledBlink, 500, LOW); tStandBy.every(5000, clearAllDisplay); tMain.every(1000, mainDisplay); tMain.every(800, realTimeScanJWS); tMain.every(2000, readAllEEPROM); //tMain.every(5000, interruptSlideShow); //geser led jws, menampilkan waktu sholat secara berurutan dari imsyaq hingga isya tHold.every(1000, holdTime); //digitalWrite(buzzer, OFF); //=Buzzer OFF //rtc.adjust(DateTime(F(__DATE__), F(__TIME__))); //rtc.adjust(DateTime(2017,10,7,11,18,30)); //a = 8; digitalWrite(buzzer, ON); delay(200); digitalWrite(buzzer, OFF); delay(200); digitalWrite(buzzer, ON); delay(200); digitalWrite(buzzer, OFF); delay(200); digitalWrite(buzzer, ON); delay(600); digitalWrite(buzzer, OFF); //delay(700); //digitalWrite(buzzer, ON); //delay(700); //digitalWrite(buzzer, OFF); //delay(2000); } //================================================================================================================== // LOOPING PROGRAM UTAMA // void loop() { DateTime now = rtc.now(); get_prayer_times(now.year(), now.month(), now.day(), lintang, bujur, zonaWaktu, times); if (remote.decode(&valRemote)) { //Jika ada sinyal remote masuk, variable Key diisi nilai kode sinyal remote yang dikirim Key = keyChar(valRemote.value); //Fungsi keyChar ada di Sketch Setting delay(200); remote.resume(); //digitalWrite(buzzer, ON); //delay(1000); //digitalWrite(buzzer, OFF); //delay(400); } if (Key == 'P' or (now.hour() == 0 and now.minute() == 0)) { // Tombol Power standby = true; Key = 0; clearAllDisplay(); } else if (Key == 'O') { // Tombol OK setting = true; Key = 0; } while (setting) { //Kalau sedang masuk dlm status setting, kunci looping program disini menuSetting(); } while (standby) { //Kl sedang dlm status standby, kunci looping program disini displayStandBy(); } if (!setting) { //clearAllDisplay(); //delay(1000); //onAllDisplay(); //delay(1000); tBlink.update(); tMain.update(); } } //================================================================================================================== void holdTime() { tDtk++; if (tDtk >= 60) { mntTunggu++; tDtk = 0; } } //================================================================================================================== void resetHoldTime() { tDtk = 0; mntTunggu = 0; } //================================================================================================================== /* void interruptSlideShow() { if (r > 5) { r = 0; } switch (r) { case 0 : a = 8; break; //trigger imsaq case 1 : a = 0; break; //trigger subuh case 2 : a = 2; break; //dhuhur case 3 : a = 3; break; //ashar case 4 : a = 5; break; //maghrib case 5 : a = 6; break; //isya } r++; } */ //==================================================================================================================
Display:
//================================================================================================================== void mainDisplay() { DateTime now = rtc.now(); digitalWrite(Latch, LOW); digitalWrite(Latch2, LOW); //clearDigitDisplay(10, LOW); //delay(1000); for (int i=0; i<=5; i++) { if (i==0) { a = 6; } else if (i==1) { a = 5; } else if (i==2) { a = 3; } else if (i==3) { a = 2; } else if (i==4) { a = 0; } else { a = 8; } //clearDigitDisplay2(24, LOW); //Serial.println("Jalankan fungsi slideShowJWS()"); slideShowJWS(); //modifikasi 1, disable sintax utk data digit d13-d17, krn hardware JWS Masjid sei. kakap berbeda //delay(4000); } //clearAllDisplay(); //delay(1000); //onAllDisplay(); //delay(1000); //clearAllDisplay(); //delay(1000); //onDigitDisplay(10, LOW); //Serial.println("MAIN DISPLAY"); onDigitDisplay(10, LOW); printDate(now.day(), now.month(), now.year()); //Modifikasi 2, sesuaikan dengan hardware JWS masjid sei. kakap //delay(1000); printTime(now.hour(), now.minute()); //modifikasi 3, sesuaikan dgn hardware kita digitalWrite(Latch, HIGH); digitalWrite(Latch2, HIGH); } //================================================================================================================== void displayStandBy() { DateTime now = rtc.now(); if (remote.decode(&valRemote)) { Key = keyChar(valRemote.value); remote.resume(); } if (Key == 'P' or (now.hour() == 3 and now.minute() == 0)) { // Tombol Power Key = (char)0; standby = false; } tBlink.update(); tStandBy.update(); } //================================================================================================================== void printDate(byte _tgl, byte _bln, int _thn) { //modifikasi 1 int _date = (_tgl * 100) + _bln; yr = 1; printRibuan(_thn); //blok program yg di modifikasi, 1 (void printRibuan(int nilai)) yr = 0; printRibuan(_date); } //================================================================================================================== void printTime(byte _jam, byte _mnt) { //modifikasi 2 int wkt = (_jam * 100) + _mnt; //printRibuan(wkt); //modifikasi untuk Digit Jam / 7 Segment Besar printRibuan2(wkt); //print jam ke display besar / port 1 } //================================================================================================================== void printTimeJWS(byte _jam, byte _mnt) { //modifikasi 2 int wkt = (_jam * 100) + _mnt; //printRibuan(wkt); //modifikasi untuk Digit Jam / 7 Segment Besar printRibuan3(wkt); //print jam ke display kecil / port 2 } //================================================================================================================== void tampilJWSWkt(int ws, long valJ) { if (ws < 30) { digitalWrite(Latch2, LOW); //Matikan display 24 digit / JWS for (int j=0; j<24; j++) { if (j==ws) //0=isya 1=maghrib 2=ashar 3=dhuhur 4=shubuh 5=imsyak { //delay(7000); printRibuan3(valJ); j += 3; } else { //shiftOut(Data2, Clock2, MSBFIRST, lowChar[10]); //shiftOut(Data2, Clock2, MSBFIRST, lowChar[11]); //matikan 7 segment shiftData3(10, LOW, false); //matikan segment } } digitalWrite(Latch2, HIGH); } else if (ws == 30) { digitalWrite(Latch2, LOW); //Matikan display 24 digit / JWS for (int k=0; k<9; k++) { if (k<5) { //delay(2000); printRibuan3(valJ); } else { //delay(2000); shiftData3(10, LOW, false); //matikan segment } } digitalWrite(Latch2, HIGH); } else if (ws == 31) { digitalWrite(Latch2, LOW); //Matikan display 24 digit / JWS for (int k=0; k<9; k++) { if (k<5) { //delay(2000); printRibuan3(valJ); } else { //delay(2000); shiftData3(10, LOW, false); //matikan segment } } digitalWrite(Latch2, HIGH); } else if (ws == 32) { digitalWrite(Latch2, LOW); //Matikan display 24 digit / JWS for (int k=0; k<9; k++) { if (k<5) { //delay(2000); printRibuan3(valJ); } else { //delay(2000); shiftData3(10, LOW, false); //matikan segment } } digitalWrite(Latch2, HIGH); } else if (ws == 33) { digitalWrite(Latch2, LOW); //Matikan display 24 digit / JWS for (int k=0; k<9; k++) { //if (k<6) { //delay(2000); printRibuan3(valJ); //} //else { //delay(2000); //shiftData3(10, LOW, false); //matikan segment //} } digitalWrite(Latch2, HIGH); } else if (ws == 34) { digitalWrite(Latch2, LOW); //Matikan display 24 digit / JWS for (int k=0; k<18; k++) { if (k<17) { shiftData3(10, LOW, false); } else { shiftText3('g'); shiftText3('N'); shiftText3('A'); shiftText3('t'); shiftText3('N'); shiftText3('I'); shiftText3('L'); } } digitalWrite(Latch2, HIGH); } else if (ws == 35) { digitalWrite(Latch2, LOW); //Matikan display 24 digit / JWS for (int k=0; k<20; k++) { if (k<19) { shiftData3(10, LOW, false); } else { //shiftText3('g'); //shiftText3('N'); shiftText3('r'); shiftText3('U'); shiftText3('J'); shiftText3('U'); shiftText3('b'); } } digitalWrite(Latch2, HIGH); } } //================================================================================================================== void clearDigitDisplay(int jumlahDigit, int aktif) { //Matikan DISPLAY BESAR for (i = 0; i < jumlahDigit; i++) { if (aktif == LOW) { if (i<6) { shiftOut(Data, Clock, MSBFIRST, lowChar[10]); //Matikan semua segment dari digit 1 (JAM) hingga digit i (1-16) } else { shiftOut(Data, Clock, MSBFIRST, lowChar2[10]); //Matikan semua segment dari digit 1 (JAM) hingga digit i (1-16) } } } } //================================================================================================================== void clearDigitDisplay2(int jumlahDigit, int aktif) { for (i = 0; i < jumlahDigit; i++) { if (aktif == LOW) { //digitalWrite(Latch2, LOW); //Matikan display 24 digit / JWS for (i=0; i<jumlahDigit; i++) { shiftOut(Data2, Clock2, MSBFIRST, lowChar[10]); } //digitalWrite(Latch2, HIGH); } } } //================================================================================================================== void clearAllDisplay() { //digitalWrite(Latch, LOW); //for (i = 0; i < 40; i++) { //shiftOut(Data, Clock, MSBFIRST, lowChar[10]); //} //digitalWrite(Latch, HIGH); digitalWrite(Latch, LOW); for (i=0; i<10; i++) //Matikan display Jam, menit, tgl, bln, thn { if (i<6) //Menampilkan angka pada Digit kecil display besar (jam) (digit ke 10-5 (urutan geser/shift 1-6 atau index 0-5)) ==> Mematikan digit { shiftOut(Data, Clock, MSBFIRST, lowChar[10]); //matikan display kecil (tgl, bln, th) } else //Menampilkan angka Digit besar display besar (jam) (digit ke 6-1 (urutan geser/shift 7-10 atau index 6-9) ==> Mematikan digit { shiftOut(Data, Clock, MSBFIRST, lowChar2[10]); //matikan display besar (jam, menit) } } digitalWrite(Latch, HIGH); digitalWrite(Latch2, LOW); //Matikan display 24 digit / JWS for (i=0; i<24; i++) { shiftOut(Data2, Clock2, MSBFIRST, lowChar[10]); } digitalWrite(Latch2, HIGH); } //================================================================================================================== void onDigitDisplay(int jumlahDigit, int aktif) { //Matikan DISPLAY BESAR for (i = 0; i < jumlahDigit; i++) { if (aktif == LOW) { if (i<6) { shiftOut(Data, Clock, MSBFIRST, lowChar[11]); //Nyalakan semua segment dari digit 1 (JAM) hingga digit i (1-16) } else { shiftOut(Data, Clock, MSBFIRST, lowChar2[11]); //Nyalakan semua segment dari digit 1 (JAM) hingga digit i (1-16) } } } } //================================================================================================================== void onDigitDisplay2(int jumlahDigit, int aktif) { //Matikan DISPLAY BESAR for (i = 0; i < jumlahDigit; i++) { if (aktif == LOW) { if (i<6) { shiftOut(Data2, Clock2, MSBFIRST, lowChar[11]); //On } else { shiftOut(Data2, Clock2, MSBFIRST, lowChar2[11]); //On } } } } void clearDigitJam(int jumlahDigit, int aktif) { //Matikan DISPLAY BESAR for (i = 0; i < jumlahDigit; i++) { if (aktif == LOW) { shiftOut(Data, Clock, MSBFIRST, lowChar2[10]); //Clear } } } //================================================================================================================== void onAllDisplay() { //digitalWrite(Latch, LOW); //for (i = 0; i < 40; i++) { //shiftOut(Data, Clock, MSBFIRST, lowChar[10]); //} //digitalWrite(Latch, HIGH); digitalWrite(Latch, LOW); for (i=0; i<10; i++) //Matikan display Jam, menit, tgl, bln, thn { if (i<6) //Menampilkan angka pada Digit kecil display besar (jam) (digit ke 10-5 (urutan geser/shift 1-6 atau index 0-5)) ==> Mematikan digit { shiftOut(Data, Clock, MSBFIRST, lowChar[11]); //matikan display kecil (tgl, bln, th) } else //Menampilkan angka Digit besar display besar (jam) (digit ke 6-1 (urutan geser/shift 7-10 atau index 6-9) ==> Mematikan digit { shiftOut(Data, Clock, MSBFIRST, lowChar2[11]); //matikan display besar (jam, menit) } } digitalWrite(Latch, HIGH); digitalWrite(Latch2, LOW); //Matikan display 24 digit / JWS for (i=0; i<24; i++) { shiftOut(Data2, Clock2, MSBFIRST, lowChar[11]); } digitalWrite(Latch2, HIGH); } //================================================================================================================== void shiftLedJWS(int jws) { switch (jws) { case 0: shiftOut(Data, Clock, MSBFIRST, ledJWS[1]); break; case 1: shiftOut(Data, Clock, MSBFIRST, ledJWS[6]); break; case 2: shiftOut(Data, Clock, MSBFIRST, ledJWS[2]); break; case 3: shiftOut(Data, Clock, MSBFIRST, ledJWS[3]); break; case 4: shiftOut(Data, Clock, MSBFIRST, ledJWS[6]); break; case 5: shiftOut(Data, Clock, MSBFIRST, ledJWS[4]); break; case 6: shiftOut(Data, Clock, MSBFIRST, ledJWS[5]); break; case 7: shiftOut(Data, Clock, MSBFIRST, ledJWS[6]); break; case 8: shiftOut(Data, Clock, MSBFIRST, ledJWS[0]); break; case 9: shiftOut(Data, Clock, MSBFIRST, ledJWS[7]); break; } } //================================================================================================================== void printRibuan(int nilai) { //modifikasi 3, sampai disini blum ada kode yg di modif ribuan = nilai / 1000; ratusan = (nilai % 1000) / 100; puluhan = ((nilai % 1000) % 100) / 10; satuan = (((nilai % 1000) % 100) % 10) % 10; if (nilai >= 1000 && nilai <= 9999) { if (yr == 1) { shiftData(satuan, LOW, false); //menuju ke blok fungsi shiftData, modifikasi 4 shiftData(puluhan, LOW, false); //shiftData(ratusan, LOW, false); //shiftData(ribuan, LOW, false); } else { shiftData(satuan, LOW, false); //menuju ke blok fungsi shiftData, modifikasi 4 shiftData(puluhan, LOW, false); shiftData(ratusan, LOW, false); shiftData(ribuan, LOW, false); } } else if (nilai >= 100 && nilai <= 999) { shiftData(satuan, LOW, false); shiftData(puluhan, LOW, false); shiftData(ratusan, LOW, false); shiftData(0, LOW, false); } else if (nilai >= 10 && nilai <= 99) { shiftData(satuan, LOW, false); shiftData(puluhan, LOW, false); shiftData(0, LOW, false); shiftData(0, LOW, false); } else { shiftData(satuan, LOW, false); shiftData(0, LOW, false); shiftData(0, LOW, false); shiftData(0, LOW, false); } } //================================================================================================================== void printRibuan2(int nilai) { //modifikasi 3, sampai disini blum ada kode yg di modif ribuan = nilai / 1000; ratusan = (nilai % 1000) / 100; puluhan = ((nilai % 1000) % 100) / 10; satuan = (((nilai % 1000) % 100) % 10) % 10; if (nilai >= 1000 && nilai <= 9999) { shiftData2(satuan, LOW, false); //buat fungsi baru shiftData2() shiftData2(puluhan, LOW, false); shiftData2(ratusan, LOW, false); shiftData2(ribuan, LOW, false); } else if (nilai >= 100 && nilai <= 999) { shiftData2(satuan, LOW, false); shiftData2(puluhan, LOW, false); shiftData2(ratusan, LOW, false); shiftData2(0, LOW, false); } else if (nilai >= 10 && nilai <= 99) { shiftData2(satuan, LOW, false); shiftData2(puluhan, LOW, false); shiftData2(0, LOW, false); shiftData2(0, LOW, false); } else { shiftData2(satuan, LOW, false); shiftData2(0, LOW, false); shiftData2(0, LOW, false); shiftData2(0, LOW, false); } //delay(4000); } //================================================================================================================== void printRibuan3(int nilai) { //modifikasi 3, sampai disini blum ada kode yg di modif ribuan = nilai / 1000; ratusan = (nilai % 1000) / 100; puluhan = ((nilai % 1000) % 100) / 10; satuan = (((nilai % 1000) % 100) % 10) % 10; if (nilai >= 1000 && nilai <= 9999) { shiftData3(satuan, LOW, false); //buat fungsi baru shiftData2() shiftData3(puluhan, LOW, false); shiftData3(ratusan, LOW, false); shiftData3(ribuan, LOW, false); } else if (nilai >= 100 && nilai <= 999) { shiftData3(satuan, LOW, false); shiftData3(puluhan, LOW, false); shiftData3(ratusan, LOW, false); shiftData3(0, LOW, false); } else if (nilai >= 10 && nilai <= 99) { shiftData3(satuan, LOW, false); shiftData3(puluhan, LOW, false); shiftData3(0, LOW, false); shiftData3(0, LOW, false); } else { shiftData3(satuan, LOW, false); shiftData3(0, LOW, false); shiftData3(0, LOW, false); shiftData3(0, LOW, false); } } //================================================================================================================== /* void printGeo(long nilai) { if (nilai >= 0) { Serial.print("PRINTGEO Nilai lintang >= 0: "); Serial.println(nilai); ratusanribu = nilai / 100000; puluhanribu = (nilai % 100000) / 10000; ribuan = ((nilai % 100000) % 10000) / 1000; ratusan = (((nilai % 100000) % 10000) % 1000) / 100; puluhan = ((((nilai % 100000) % 10000) % 1000) % 100) / 10; satuan = ((((nilai % 100000) % 10000) % 1000) % 100) % 10; } else { Serial.print("PRINTGEO Nilai lintang < 0: "); Serial.println(nilai); ratusanribu = abs(nilai / 100000); puluhanribu = abs((nilai % 100000) / 10000); ribuan = abs(((nilai % 100000) % 10000) / 1000); ratusan = abs((((nilai % 100000) % 10000) % 1000) / 100); puluhan = abs(((((nilai % 100000) % 10000) % 1000) % 100) / 10); satuan = abs(((((nilai % 100000) % 10000) % 1000) % 100) % 10); } if (nilai >= 100000 && nilai <= 999999) { shiftData(satuan, LOW, true); shiftData(puluhan, LOW, false); shiftData(ratusan, LOW, false); shiftData(ribuan, LOW, true); shiftData(puluhanribu, LOW, false); shiftData(ratusanribu, LOW, false); } else if (nilai >= 10000 && nilai <= 99999) { shiftData(satuan, LOW, true); shiftData(puluhan, LOW, false); shiftData(ratusan, LOW, false); shiftData(ribuan, LOW, true); shiftData(puluhanribu, LOW, false); shiftData(10, LOW, false); } else if (nilai >= 1000 && nilai <= 9999) { shiftData(satuan, LOW, true); shiftData(puluhan, LOW, false); shiftData(ratusan, LOW, false); shiftData(ribuan, LOW, true); shiftData(10, LOW, false); shiftData(10, LOW, false); } else if (nilai >= 100 && nilai <= 999) { shiftData(satuan, LOW, true); shiftData(puluhan, LOW, false); shiftData(ratusan, LOW, false); shiftData(10, LOW, false); shiftData(10, LOW, false); shiftData(10, LOW, false); } else if (nilai >= 10 && nilai <= 99) { shiftData(satuan, LOW, true); shiftData(puluhan, LOW, false); shiftData(10, LOW, false); shiftData(10, LOW, false); shiftData(10, LOW, false); shiftData(10, LOW, false); } else if (nilai < 10 && nilai >= 0) { Serial.print("shiftData nilai<10&&>=0: "); Serial.println(nilai); shiftData(satuan, LOW, true); shiftData(10, LOW, false); shiftData(10, LOW, false); shiftData(10, LOW, false); shiftData(10, LOW, false); shiftData(10, LOW, false); } else if (nilai <= -1 && nilai >= -10) { Serial.print("shiftData nilai<-1&&>=-10: "); Serial.println(nilai); shiftData(satuan, LOW, true); shiftData(11, LOW, false); //minus sign shiftData(10, LOW, false); shiftData(10, LOW, false); shiftData(10, LOW, false); shiftData(10, LOW, false); } else if (nilai <= -10 && nilai >= -99) { Serial.print("shiftData nilai<-10&&>=-99: "); Serial.println(nilai); shiftData(satuan, LOW, true); shiftData(puluhan, LOW, false); shiftData(11, LOW, false); shiftData(10, LOW, false); shiftData(10, LOW, false); shiftData(10, LOW, false); } else if (nilai <= -100 && nilai >= -999) { Serial.print("shiftData nilai<-100&&>=-999: "); Serial.println(nilai); shiftData(satuan, LOW, true); shiftData(puluhan, LOW, false); shiftData(ratusan, LOW, false); shiftData(11, LOW, false); shiftData(10, LOW, false); shiftData(10, LOW, false); } else if (nilai <= -1000 && nilai >= -9999) { shiftData(satuan, LOW, true); shiftData(puluhan, LOW, false); shiftData(ratusan, LOW, false); shiftData(ribuan, LOW, true); shiftData(11, LOW, false); shiftData(10, LOW, false); } else if (nilai <= -10000 && nilai >= -99999) { shiftData(satuan, LOW, true); shiftData(puluhan, LOW, false); shiftData(ratusan, LOW, false); shiftData(ribuan, LOW, true); shiftData(puluhanribu, LOW, false); shiftData(11, LOW, false); } delay(2000); } */ //================================================================================================================== void printPuluhan(byte nilai) { puluhan = nilai / 10; satuan = nilai % 10; if (nilai >= 10 && nilai <= 99) { shiftData(satuan, LOW, false); shiftData(puluhan, LOW, false); } else { shiftData(satuan, LOW, false); shiftData(10, LOW, false); } } //================================================================================================================== void shiftData(int nilai, int aktif, bool point) { //modifikasi 5 if (aktif == LOW) { if (point) { switch (nilai) { case 0: shiftOut(Data, Clock, MSBFIRST, lowCharPoint[0]); break; case 1: shiftOut(Data, Clock, MSBFIRST, lowCharPoint[1]); break; case 2: shiftOut(Data, Clock, MSBFIRST, lowCharPoint[2]); break; case 3: shiftOut(Data, Clock, MSBFIRST, lowCharPoint[3]); break; case 4: shiftOut(Data, Clock, MSBFIRST, lowCharPoint[4]); break; case 5: shiftOut(Data, Clock, MSBFIRST, lowCharPoint[5]); break; case 6: shiftOut(Data, Clock, MSBFIRST, lowCharPoint[6]); break; case 7: shiftOut(Data, Clock, MSBFIRST, lowCharPoint[7]); break; case 8: shiftOut(Data, Clock, MSBFIRST, lowCharPoint[8]); break; case 9: shiftOut(Data, Clock, MSBFIRST, lowCharPoint[9]); break; case 10: shiftOut(Data, Clock, MSBFIRST, lowCharPoint[10]); break; } } else { //delay(2000); //Serial.println("shiftOut(Data,Clock...)"); switch (nilai) { case 0: shiftOut(Data, Clock, MSBFIRST, lowChar[0]); break; //menuju ke block program lowChar[] utk modifikasi nilai / pemetaan ulang data byte utk penampilan angka case 1: shiftOut(Data, Clock, MSBFIRST, lowChar[1]); break; case 2: shiftOut(Data, Clock, MSBFIRST, lowChar[2]); break; case 3: shiftOut(Data, Clock, MSBFIRST, lowChar[3]); break; case 4: shiftOut(Data, Clock, MSBFIRST, lowChar[4]); break; case 5: shiftOut(Data, Clock, MSBFIRST, lowChar[5]); break; case 6: shiftOut(Data, Clock, MSBFIRST, lowChar[6]); break; case 7: shiftOut(Data, Clock, MSBFIRST, lowChar[7]); break; case 8: shiftOut(Data, Clock, MSBFIRST, lowChar[8]); break; case 9: shiftOut(Data, Clock, MSBFIRST, lowChar[9]); break; case 10: shiftOut(Data, Clock, MSBFIRST, lowChar[10]); break; case 11: shiftOut(Data, Clock, MSBFIRST, lowChar[11]); break; } } } } //================================================================================================================== void shiftData2(int nilai, int aktif, bool point) { //modifikasi 5 if (aktif == LOW) { //delay(2000); if (point) { switch (nilai) { case 0: shiftOut(Data, Clock, MSBFIRST, lowCharPoint[0]); break; case 1: shiftOut(Data, Clock, MSBFIRST, lowCharPoint[1]); break; case 2: shiftOut(Data, Clock, MSBFIRST, lowCharPoint[2]); break; case 3: shiftOut(Data, Clock, MSBFIRST, lowCharPoint[3]); break; case 4: shiftOut(Data, Clock, MSBFIRST, lowCharPoint[4]); break; case 5: shiftOut(Data, Clock, MSBFIRST, lowCharPoint[5]); break; case 6: shiftOut(Data, Clock, MSBFIRST, lowCharPoint[6]); break; case 7: shiftOut(Data, Clock, MSBFIRST, lowCharPoint[7]); break; case 8: shiftOut(Data, Clock, MSBFIRST, lowCharPoint[8]); break; case 9: shiftOut(Data, Clock, MSBFIRST, lowCharPoint[9]); break; case 10: shiftOut(Data, Clock, MSBFIRST, lowCharPoint[10]); break; } } else { //delay(2000); //Serial.print("shiftData2(), nilai: "); //Serial.println(nilai); switch (nilai) { case 0: shiftOut(Data, Clock, MSBFIRST, lowChar2[0]); break; //modifikasi ke lowChar2[] case 1: shiftOut(Data, Clock, MSBFIRST, lowChar2[1]); break; case 2: shiftOut(Data, Clock, MSBFIRST, lowChar2[2]); break; case 3: shiftOut(Data, Clock, MSBFIRST, lowChar2[3]); break; case 4: shiftOut(Data, Clock, MSBFIRST, lowChar2[4]); break; case 5: shiftOut(Data, Clock, MSBFIRST, lowChar2[5]); break; case 6: shiftOut(Data, Clock, MSBFIRST, lowChar2[6]); break; case 7: shiftOut(Data, Clock, MSBFIRST, lowChar2[7]); break; case 8: shiftOut(Data, Clock, MSBFIRST, lowChar2[8]); break; case 9: shiftOut(Data, Clock, MSBFIRST, lowChar2[9]); break; case 10: shiftOut(Data, Clock, MSBFIRST, lowChar2[10]); break; case 11: shiftOut(Data, Clock, MSBFIRST, lowChar2[11]); break; } } } } //================================================================================================================== void shiftData3(int nilai, int aktif, bool point) { //modifikasi 5 if (aktif == LOW) { if (point) { switch (nilai) { case 0: shiftOut(Data, Clock, MSBFIRST, lowCharPoint[0]); break; case 1: shiftOut(Data, Clock, MSBFIRST, lowCharPoint[1]); break; case 2: shiftOut(Data, Clock, MSBFIRST, lowCharPoint[2]); break; case 3: shiftOut(Data, Clock, MSBFIRST, lowCharPoint[3]); break; case 4: shiftOut(Data, Clock, MSBFIRST, lowCharPoint[4]); break; case 5: shiftOut(Data, Clock, MSBFIRST, lowCharPoint[5]); break; case 6: shiftOut(Data, Clock, MSBFIRST, lowCharPoint[6]); break; case 7: shiftOut(Data, Clock, MSBFIRST, lowCharPoint[7]); break; case 8: shiftOut(Data, Clock, MSBFIRST, lowCharPoint[8]); break; case 9: shiftOut(Data, Clock, MSBFIRST, lowCharPoint[9]); break; case 10: shiftOut(Data, Clock, MSBFIRST, lowCharPoint[10]); break; } } else { switch (nilai) { case 0: shiftOut(Data2, Clock2, MSBFIRST, lowChar[0]); break; //modifikasi ke lowChar2[] case 1: shiftOut(Data2, Clock2, MSBFIRST, lowChar[1]); break; case 2: shiftOut(Data2, Clock2, MSBFIRST, lowChar[2]); break; case 3: shiftOut(Data2, Clock2, MSBFIRST, lowChar[3]); break; case 4: shiftOut(Data2, Clock2, MSBFIRST, lowChar[4]); break; case 5: shiftOut(Data2, Clock2, MSBFIRST, lowChar[5]); break; case 6: shiftOut(Data2, Clock2, MSBFIRST, lowChar[6]); break; case 7: shiftOut(Data2, Clock2, MSBFIRST, lowChar[7]); break; case 8: shiftOut(Data2, Clock2, MSBFIRST, lowChar[8]); break; case 9: shiftOut(Data2, Clock2, MSBFIRST, lowChar[9]); break; case 10: shiftOut(Data2, Clock2, MSBFIRST, lowChar[10]); break; //matikan seluruh segment case 11: shiftOut(Data2, Clock2, MSBFIRST, lowChar[11]); break; //nyalakan seluruh segment } } } } //================================================================================================================== void shiftText(char huruf) { switch (huruf) { case 'A': shiftOut(Data, Clock, MSBFIRST, textChar[0]); break; case 'I': shiftOut(Data, Clock, MSBFIRST, textChar[1]); break; case 'U': shiftOut(Data, Clock, MSBFIRST, textChar[2]); break; case 'u': shiftOut(Data, Clock, MSBFIRST, textChar[3]); break; case 'E': shiftOut(Data, Clock, MSBFIRST, textChar[4]); break; case 'O': shiftOut(Data, Clock, MSBFIRST, textChar[5]); break; case 'o': shiftOut(Data, Clock, MSBFIRST, textChar[6]); break; case 'J': shiftOut(Data, Clock, MSBFIRST, textChar[7]); break; case 'L': shiftOut(Data, Clock, MSBFIRST, textChar[8]); break; case 'N': shiftOut(Data, Clock, MSBFIRST, textChar[9]); break; case 'n': shiftOut(Data, Clock, MSBFIRST, textChar[10]); break; case 'H': shiftOut(Data, Clock, MSBFIRST, textChar[11]); break; case 'h': shiftOut(Data, Clock, MSBFIRST, textChar[12]); break; case 'Y': shiftOut(Data, Clock, MSBFIRST, textChar[13]); break; case 't': shiftOut(Data, Clock, MSBFIRST, textChar[14]); break; case 'Z': shiftOut(Data, Clock, MSBFIRST, textChar[15]); break; case 'r': shiftOut(Data, Clock, MSBFIRST, textChar[16]); break; case 'b': shiftOut(Data, Clock, MSBFIRST, textChar[17]); break; case 'd': shiftOut(Data, Clock, MSBFIRST, textChar[18]); break; case 'S': shiftOut(Data, Clock, MSBFIRST, textChar[19]); break; case 'g': shiftOut(Data, Clock, MSBFIRST, textChar[20]); break; case '`': shiftOut(Data, Clock, MSBFIRST, textChar[21]); break; case 'P': shiftOut(Data, Clock, MSBFIRST, textChar[22]); break; case 'M': shiftOut(Data, Clock, MSBFIRST, textChar[24]); shiftOut(Data, Clock, MSBFIRST, textChar[23]); break; } } void shiftText2(char huruf) { switch (huruf) { case 'A': shiftOut(Data, Clock, MSBFIRST, textChar2[0]); break; case 'I': shiftOut(Data, Clock, MSBFIRST, textChar2[1]); break; case 'U': shiftOut(Data, Clock, MSBFIRST, textChar2[2]); break; case 'u': shiftOut(Data, Clock, MSBFIRST, textChar2[3]); break; case 'E': shiftOut(Data, Clock, MSBFIRST, textChar2[4]); break; case 'O': shiftOut(Data, Clock, MSBFIRST, textChar2[5]); break; case 'o': shiftOut(Data, Clock, MSBFIRST, textChar2[6]); break; case 'J': shiftOut(Data, Clock, MSBFIRST, textChar2[7]); break; case 'L': shiftOut(Data, Clock, MSBFIRST, textChar2[8]); break; case 'N': shiftOut(Data, Clock, MSBFIRST, textChar2[9]); break; case 'n': shiftOut(Data, Clock, MSBFIRST, textChar2[10]); break; case 'H': shiftOut(Data, Clock, MSBFIRST, textChar2[11]); break; case 'h': shiftOut(Data, Clock, MSBFIRST, textChar2[12]); break; case 'Y': shiftOut(Data, Clock, MSBFIRST, textChar2[13]); break; case 't': shiftOut(Data, Clock, MSBFIRST, textChar2[14]); break; case 'Z': shiftOut(Data, Clock, MSBFIRST, textChar2[15]); break; case 'r': shiftOut(Data, Clock, MSBFIRST, textChar2[16]); break; case 'b': shiftOut(Data, Clock, MSBFIRST, textChar2[17]); break; case 'd': shiftOut(Data, Clock, MSBFIRST, textChar2[18]); break; case 'S': shiftOut(Data, Clock, MSBFIRST, textChar2[19]); break; case 'g': shiftOut(Data, Clock, MSBFIRST, textChar2[20]); break; case '`': shiftOut(Data, Clock, MSBFIRST, textChar2[21]); break; case 'P': shiftOut(Data, Clock, MSBFIRST, textChar2[22]); break; case 'M': shiftOut(Data, Clock, MSBFIRST, textChar2[24]); shiftOut(Data, Clock, MSBFIRST, textChar2[23]); break; } } void shiftText3(char huruf) { switch (huruf) { case 'A': shiftOut(Data2, Clock2, MSBFIRST, textChar[0]); break; case 'I': shiftOut(Data2, Clock2, MSBFIRST, textChar[1]); break; case 'U': shiftOut(Data2, Clock2, MSBFIRST, textChar[2]); break; case 'u': shiftOut(Data2, Clock2, MSBFIRST, textChar[3]); break; case 'E': shiftOut(Data2, Clock2, MSBFIRST, textChar[4]); break; case 'O': shiftOut(Data2, Clock2, MSBFIRST, textChar[5]); break; case 'o': shiftOut(Data2, Clock2, MSBFIRST, textChar[6]); break; case 'J': shiftOut(Data2, Clock2, MSBFIRST, textChar[7]); break; case 'L': shiftOut(Data2, Clock2, MSBFIRST, textChar[8]); break; case 'N': shiftOut(Data2, Clock2, MSBFIRST, textChar[9]); break; case 'n': shiftOut(Data2, Clock2, MSBFIRST, textChar[10]); break; case 'H': shiftOut(Data2, Clock2, MSBFIRST, textChar[11]); break; case 'h': shiftOut(Data2, Clock2, MSBFIRST, textChar[12]); break; case 'Y': shiftOut(Data2, Clock2, MSBFIRST, textChar[13]); break; case 't': shiftOut(Data2, Clock2, MSBFIRST, textChar[14]); break; case 'Z': shiftOut(Data2, Clock2, MSBFIRST, textChar[15]); break; case 'r': shiftOut(Data2, Clock2, MSBFIRST, textChar[16]); break; case 'b': shiftOut(Data2, Clock2, MSBFIRST, textChar[17]); break; case 'd': shiftOut(Data2, Clock2, MSBFIRST, textChar[18]); break; case 'S': shiftOut(Data2, Clock2, MSBFIRST, textChar[19]); break; case 'g': shiftOut(Data2, Clock2, MSBFIRST, textChar[20]); break; case '`': shiftOut(Data2, Clock2, MSBFIRST, textChar[21]); break; case 'P': shiftOut(Data2, Clock2, MSBFIRST, textChar[22]); break; case 'M': shiftOut(Data2, Clock2, MSBFIRST, textChar[24]); shiftOut(Data2, Clock2, MSBFIRST, textChar[23]); break; } } //================================================================================================================== void printText(byte nilai) { if (nilai == 0) { // Text Jeda shiftText('A'); shiftText('d'); shiftText('E'); shiftText('J'); } else if (nilai == 1) { // Text Mp3 shiftData(3, LOW, false); shiftText('P'); shiftText('M'); } else if (nilai == 2) { // Text Mp3 shiftData(11, LOW, false); shiftText('N'); shiftText('O'); shiftData(11, LOW, false); } else if (nilai == 3) { // Text Mp3 shiftData(11, LOW, false); shiftText('F'); shiftText('F'); shiftText('O'); } else if (nilai == 4) { // Text Mp3 shiftText('t'); shiftText('t'); shiftText('E'); shiftText('S'); } else if (nilai == 5) { // Text Mp3 //shiftData(11, LOW, false); //hanya segment g nyala, sudah di modif all segment on shiftData(10, LOW, false); //all segment off shiftText('h'); shiftText('U'); shiftText('b'); shiftText('U'); shiftText('S'); //shiftData(11, LOW, false); //hanya segment g nyala, sdh di modif all segment on //shiftData(10, LOW, false); //hanya segment g nyala, sdh di modif all segment on } else if (nilai == 6) { // Text Mp3 //shiftData(11, LOW, false); shiftText('r'); shiftText('U'); shiftText('h'); shiftText('U'); shiftText('h'); shiftText('d'); //shiftData(11, LOW, false); } else if (nilai == 7) { // Text Mp3 //shiftData(11, LOW, false); //shiftData(10, LOW, false); shiftData(10, LOW, false); shiftText('r'); shiftText('A'); shiftText('H'); shiftText('S'); shiftText('A'); //shiftData(11, LOW, false); } else if (nilai == 8) { // Text Mp3 shiftText('b'); //shiftText('I'); shiftText('r'); shiftText('H'); shiftText('g'); shiftText('A'); shiftText('M'); } else if (nilai == 9) { // Text Mp3 //shiftData(11, LOW, false); shiftData(10, LOW, false); shiftText('A'); shiftText('Y'); shiftText('S'); shiftText('I'); shiftData(10, LOW, false); //shiftData(11, LOW, false); } else if (nilai == 10) { // Text Mp3 //shiftData(11, LOW, false); shiftText('t'); shiftText('A'); shiftText('M'); shiftText('U'); shiftText('J'); //shiftData(11, LOW, false); } else if (nilai == 11) { // Text Mp3 shiftData(10, LOW, false); shiftData(10, LOW, false); //shiftData(11, LOW, false); shiftText('I'); shiftText('t'); shiftText('A'); shiftText('M'); //shiftData(10, LOW, false); //shiftData(11, LOW, false); } else if (nilai == 12) { // Text Mp3 //shiftData(11, LOW, false); shiftData(10, LOW, false); shiftText('N'); shiftText('A'); shiftText('Z'); shiftText('d'); shiftText('A'); //shiftData(11, LOW, false); } else if (nilai == 13) { // Text Zona //shiftData(11, LOW, false); shiftData(10, LOW, false); shiftData(10, LOW, false); shiftText('A'); shiftText('N'); shiftText('O'); shiftText('Z'); //shiftData(10, LOW, false); //shiftData(11, LOW, false); } else if (nilai == 14) { // Text Selisi //shiftData(11, LOW, false); shiftText('I'); shiftText('S'); shiftText('I'); shiftText('L'); shiftText('E'); shiftText('S'); //shiftData(11, LOW, false); } else if (nilai == 15) { // Text Lintang shiftText('t'); shiftText('N'); shiftText('I'); shiftText('L'); } else if (nilai == 16) { // Text Bujur shiftText('r'); shiftText('J'); shiftText('U'); shiftText('b'); } } //================================================================================================================== void printText2(byte nilai) { if (nilai == 0) { // Text Jeda shiftText2('A'); shiftText2('d'); shiftText2('E'); shiftText2('J'); } else if (nilai == 1) { // Text Mp3 shiftData(3, LOW, false); shiftText('P'); shiftText('M'); } else if (nilai == 2) { // Text Mp3 shiftData(11, LOW, false); shiftText('N'); shiftText('O'); shiftData(11, LOW, false); } else if (nilai == 3) { // Text Mp3 shiftData(11, LOW, false); shiftText('F'); shiftText('F'); shiftText('O'); } else if (nilai == 4) { // Text Mp3 shiftText2('t'); shiftText2('t'); shiftText2('E'); shiftText2('S'); } else if (nilai == 5) { // Text Mp3 //shiftData(11, LOW, false); //hanya segment g nyala, sudah di modif all segment on //shiftData(10, LOW, false); //all segment off shiftText('h'); shiftText('U'); shiftText('b'); shiftText('U'); shiftText('S'); //shiftData(11, LOW, false); //hanya segment g nyala, sdh di modif all segment on } else if (nilai == 6) { // Text Mp3 shiftData(11, LOW, false); shiftText('r'); shiftText('U'); shiftText('h'); shiftText('U'); shiftText('h'); shiftText('d'); shiftData(11, LOW, false); } else if (nilai == 7) { // Text Mp3 shiftData(11, LOW, false); shiftData(10, LOW, false); shiftText('r'); shiftText('A'); shiftText('H'); shiftText('S'); shiftText('A'); shiftData(11, LOW, false); } else if (nilai == 8) { // Text Mp3 shiftText('b'); shiftText('I'); shiftText('r'); shiftText('H'); shiftText('g'); shiftText('A'); shiftText('M'); } else if (nilai == 9) { // Text Mp3 shiftData(11, LOW, false); shiftData(10, LOW, false); shiftText('A'); shiftText('Y'); shiftText('S'); shiftText('I'); shiftData(10, LOW, false); shiftData(11, LOW, false); } else if (nilai == 10) { // Text Mp3 shiftData(11, LOW, false); shiftText('t'); shiftText('A'); shiftText('M'); shiftText('U'); shiftText('J'); shiftData(11, LOW, false); } else if (nilai == 11) { // Text Mp3 shiftData(11, LOW, false); shiftData(10, LOW, false); shiftText('N'); shiftText('A'); shiftText('Z'); shiftText('d'); shiftText('A'); shiftData(11, LOW, false); } else if (nilai == 12) { // Text Mp3 shiftData(11, LOW, false); shiftText('I'); shiftText('t'); shiftText('A'); shiftText('M'); shiftData(10, LOW, false); shiftData(11, LOW, false); } else if (nilai == 13) { // Text Zona shiftData(11, LOW, false); shiftData(10, LOW, false); shiftText('A'); shiftText('N'); shiftText('O'); shiftText('Z'); shiftData(10, LOW, false); shiftData(11, LOW, false); } else if (nilai == 14) { // Text Selisi shiftData(11, LOW, false); shiftText('I'); shiftText('S'); shiftText('I'); shiftText('L'); shiftText('E'); shiftText('S'); shiftData(11, LOW, false); } else if (nilai == 15) { // Text Lintang shiftText('t'); shiftText('N'); shiftText('I'); shiftText('L'); } else if (nilai == 16) { // Text Bujur shiftText('r'); shiftText('J'); shiftText('U'); shiftText('b'); } }
Jadwal_Sholat:
//================================================================================================================== void slideShowJWS() { get_float_time_parts(times[a], jamSholat, mntSholat); mntSholat += selisihWaktu; //Menit sholat ditambahkan dengan selisih waktu if (mntSholat >= 60) { //jika hasilnya adalah 60 atau lebih, maka mntSholat = 0; //menit sholat dijadikan nol, dan jamSholat++; //Jam sholat dinaikkan 1 } if (a == 8) { //jika a bernilai 8, note: pada inisiasi pertama program dijalankan (void(setup)), a diberi nilai 8 //Serial.println("Jalankan fungsi get_float_time_parts(times[0], jamSholat, mntSholat)"); get_float_time_parts(times[0], jamSholat, mntSholat); //waktu imsaq mntSholat += selisihWaktu; if (mntSholat < 10) { mntSholat = 60 - mntSholat; jamSholat--; } else { mntSholat = mntSholat - 10 ; } } //Serial.print("Jam Sholat: "); //Serial.print(jamSholat); //Serial.print(":"); //Serial.println(mntSholat); //shiftLedJWS(a); //printTime(jamSholat, mntSholat); printTimeJWS(jamSholat, mntSholat); } //================================================================================================================== void displayMati(byte jeda) { clearAllDisplay(); resetHoldTime(); while (jeda >= mntTunggu) { tBlink.update(); tHold.update(); if (digitalRead(ledBlink) == LOW) { clearAllDisplay(); } } } //================================================================================================================== void realTimeScanJWS() { for (i = 0; i < 7; i++) { //Cek jam saat ini apakah sama dengan wkt sholat dari shubuh atau dhuhur atau ashar atau maghrib atau isya ? DateTime now = rtc.now(); if (i == 1 or i == 4) { //yg dipakai hanya 6 5 3 2 0 (8 tidak termauk, krn waktu imsaq) i++; //6 isya, 5 maghrib, 3 ashar, 2 dhuhur, 0 shubuh } get_float_time_parts(times[i], jamSholat, mntSholat); //baca jam wkt sholat sesuai urutan (i) mntSholat += selisihWaktu; if (mntSholat >= 60) { mntSholat = 0; jamSholat++; } if (now.dayOfTheWeek() == 5 and i == 2 and jamSholat == now.hour() and mntSholat == now.minute()) { // "5" = Hari Jumat, "2" = Sholat Dhuhur = sholat Jum'at alarmJumat(2, jamSholat, mntSholat); } else if (jamSholat == now.hour() && mntSholat == now.minute()) { //Serial.println("Fungsi dijalankan: alarmJWS())"); alarmJWS(i, jamSholat, mntSholat); } } } //================================================================================================================== void alarmJWS(byte jws, byte _jam, byte _mnt) { // wkt tunggu adzan //readAllEEPROM(); e = 0; //1; resetHoldTime(); while (jedaAdzan >= mntTunggu) { DateTime now = rtc.now(); v = now.second() % 2; digitalWrite(Latch, LOW); digitalWrite(Latch2, LOW); if (jws == 0) { // Deteksi Sholat Subuh if (v == 0) { //shiftLedJWS(jws); //printTime(_jam, _mnt); //printText(5); //word shubuh printText(5); //word shubuh val = (_jam * 100) + _mnt; tampilJWSWkt(16, val); //Shubuh } else if (v == 1) { //shiftLedJWS(7); //tampilJWSWkt(16, val); //Shubuh clearDigitDisplay(6, LOW); clearDigitDisplay2(24, LOW); } } else if (jws == 2) { // Deteksi Sholat Dhuhur if (v == 0) { //shiftLedJWS(jws); //printTime(_jam, _mnt); //printText(6); printText(6); //word dhuhur val = (_jam * 100) + _mnt; tampilJWSWkt(12, val); //Dhuhur } else if (v == 1) { //shiftLedJWS(7); //clearDigitDisplay(12, LOW); clearDigitDisplay(6, LOW); clearDigitDisplay2(24, LOW); } } else if (jws == 3) { // Deteksi Sholat Ashar if (v == 0) { //shiftLedJWS(jws); //printTime(_jam, _mnt); //printText(7); //tampilJWSWkt(8, val); //Ashar printText(7); //word dhuhur val = (_jam * 100) + _mnt; tampilJWSWkt(8, val); //Ashar } else if (v == 1) { //shiftLedJWS(7); //clearDigitDisplay(12, LOW); clearDigitDisplay(6, LOW); clearDigitDisplay2(24, LOW); } } else if (jws == 5) { // Deteksi Sholat Maghrib if (v == 0) { //shiftLedJWS(jws); //printTime(_jam, _mnt); //printText(8); printText(8); //word dhuhur val = (_jam * 100) + _mnt; tampilJWSWkt(4, val); //Maghrib } else if (v == 1) { //shiftLedJWS(7); //clearDigitDisplay(12, LOW); clearDigitDisplay(6, LOW); clearDigitDisplay2(24, LOW); } } else if (jws == 6) { // Deteksi Sholat Isya if (v == 0) { //shiftLedJWS(jws); //printTime(_jam, _mnt); printText(9); val = (_jam * 100) + _mnt; tampilJWSWkt(0, val); //'Isya } else if (v == 1) { //shiftLedJWS(7); //clearDigitDisplay(12, LOW); clearDigitDisplay(6, LOW); clearDigitDisplay2(24, LOW); } } printTime(now.hour(), now.minute()); digitalWrite(Latch, HIGH); digitalWrite(Latch2, HIGH); // Buzzer 10x Bunyi ==> 3x if (v == 0) { digitalWrite(buzzer, e); //1 = buzzer OFF, 0 = buzzer ON } else { digitalWrite(buzzer, OFF); } if (tDtk >= 6 or mntTunggu > 0) { //(tDtk >= 20 or mntTunggu > 0) { e = 1; //0; } tBlink.update(); tHold.update(); } waitIqomah(jws); } //================================================================================================================== void waitIqomah(byte jeda) { //wkt tunggu iqomah switch (jeda) { case 0 : e = 0; break; // Waktu Tunggu Iqomah Subuh case 2 : e = 1; break; // Waktu Tunggu Iqomah Dhuhur case 3 : e = 2; break; // Waktu Tunggu Iqomah Ashar case 5 : e = 3; break; // Waktu Tunggu Iqomah Maghrib case 6 : e = 4; break; // Waktu Tunggu Iqomah Isya' } mnt = jedaIqomah[e]; dtk = 0; digitalWrite(ledBlink, LOW); while (1) { DateTime now = rtc.now(); v = now.second() % 2; digitalWrite(Latch, LOW); digitalWrite(Latch2, LOW); //clearDigitDisplay(13, LOW); //printTime(mnt, dtk); clearDigitDisplay(6, LOW); printTime(mnt, dtk); clearDigitDisplay2(24, LOW); digitalWrite(Latch, HIGH); digitalWrite(Latch2, HIGH); if (mnt <= 0 and dtk < 3) { //(mnt <= 0 and dtk < 10) { digitalWrite(buzzer, ON); } if (mnt == 0 and dtk < 0 ) { digitalWrite(buzzer, OFF); break; } delay(500); digitalWrite(buzzer, OFF); delay(500); if (mnt <= 0 and dtk <= 0 ) { digitalWrite(buzzer, OFF); break; } dtk--; if (dtk < 0) { mnt--; dtk = 59; } } displayMati(jedaMati); } //================================================================================================================== void alarmJumat(byte jws, byte _jam, byte _mnt) { resetHoldTime(); while (jedaJumat >= mntTunggu) { tHold.update(); DateTime now = rtc.now(); v = now.second() % 2; digitalWrite(Latch, LOW); digitalWrite(Latch2, LOW); if (v == 0) { //printTime(_jam, _mnt); //shiftLedJWS(jws); //printText(10); printText(10); val = (_jam * 100) + _mnt; tampilJWSWkt(12, val); //Dhuhur } else if (v == 1) { //clearDigitDisplay(13, LOW); clearDigitDisplay(6, LOW); clearDigitDisplay2(24, LOW); } printTime(now.hour(), now.minute()); digitalWrite(Latch, HIGH); digitalWrite(Latch2, HIGH); if (v == 0) { digitalWrite(buzzer, e); //1 = buzzer OFF, 0 = buzzer ON } else { digitalWrite(buzzer, OFF); } if (tDtk >= 6 or mntTunggu > 0) { //(tDtk >= 20 or mntTunggu > 0) { e = 1; //0; } //tBlink.update(); //tHold.update(); } displayMati(jedaJumat); } //==================================================================================================================
Setting:
//================================================================================================================== char keyChar(long data) { digitalWrite(buzzer, ON); delay(100); digitalWrite(buzzer, OFF); switch (data) { //Protocol SAMSUNG 050 case 3772811383 : return '0'; break; // Angka 0 case 3772784863 : return '1'; break; // Angka 1 case 3772817503 : return '2'; break; // Angka 2 case 3772801183 : return '3'; break; // Angka 3 case 3772780783 : return '4'; break; // Angka 4 case 3772813423 : return '5'; break; // Angka 5 case 3772797103 : return '6'; break; // Angka 6 case 3772788943 : return '7'; break; // Angka 7 case 3772821583 : return '8'; break; // Angka 8 case 3772805263 : return '9'; break; // Angka 9 case 3772826683 : return '.'; break; // Titik . case 3772833823 : return '+'; break; // Minus + case 3772829743 : return '-'; break; // Minus - case 3772793023 : return 'P'; break; // Tombol Power //case 3772815463 : return 'O'; break; // OK case 3772799143 : return 'O'; break; //tombol OK ganti Menu case 3772835863 : return 'U'; break; // Atas case 3772831783 : return 'D'; break; // Bawah case 3772790983 : return 'L'; break; // Kiri case 3772823623 : return 'R'; break; // Kanan case 3772839943 : return 'C'; break; // Recall case 3772827703 : return 'E'; break; // Exit case 3772795063 : return '>'; break; // CH + case 3772778743 : return '<'; break; // CH - default : break; } // digitalWrite(buzzer, ON); //delay(100); //digitalWrite(buzzer, OFF); } //================================================================================================================== void readAllEEPROM() { jedaIqomah[0] = eeprom_read_byte((uint8_t*)0); // EEPROM Jeda Subuh jedaIqomah[1] = eeprom_read_byte((uint8_t*)1); // EEPROM Jeda Dhuhur jedaIqomah[2] = eeprom_read_byte((uint8_t*)2); // EEPROM Jeda Ashar jedaIqomah[3] = eeprom_read_byte((uint8_t*)3); // EEPROM Jeda Maghrib jedaIqomah[4] = eeprom_read_byte((uint8_t*)4); // EEPROM Jeda Isya jedaJumat = eeprom_read_byte((uint8_t*)5); // EEPROM Jeda Jumat jedaMati = eeprom_read_byte((uint8_t*)6); // EEPROM Jeda Mati jedaAdzan = eeprom_read_byte((uint8_t*)9); // EEPROM Jeda Mati selisihWaktu = eeprom_read_byte((uint8_t*)7); // EEPROM selesi Waktu / kalibrasi zonaWaktu = eeprom_read_byte((uint8_t*)8); // EEPROM Zona Waktu //lintang = eeprom_read_float((float*)10); // EEPROM Lintang //bujur = eeprom_read_float((float*)15); // EEPROM Bujur adzan = eeprom_read_byte((uint8_t*)30); // EEPROM Automatis adzan } //================================================================================================================== void inputSetting(int maxDigit) { if (remote.decode(&valRemote)) { Key = keyChar(valRemote.value); remote.resume(); } if (n < maxDigit) { if (Key) { if ((Key >= 48 and Key <= 57)) { //angka 0-9 ditekan charBuffer[n] = Key; n++; } } } } //================================================================================================================== void readVarRTC() { DateTime now = rtc.now(); v = now.second() % 2; jam = now.hour(); mnt = now.minute(); tgl = now.day(); bln = now.month(); thn = now.year(); } //================================================================================================================== void clearBuffer() { for (i = 0; i < 10; i++) { charBuffer[i] = 0; floatBuff[i] = 0; //asli //charBuffer[i] = 0; //if (i<4) //{ //floatBuff[i] = 0; //} } n = 0; a = 0; } //================================================================================================================== void menuSetting() { DateTime now = rtc.now(); readVarRTC(); //************************************************************************************* Setting Time setTIME: //Serial.println("setTIME"); //Serial.println("Delay 2s"); //delay(2000); inputSetting(4); tBlink.update(); if (Key == 'C') { // Tombol Delete /Recall ==> Masuk ke setting TIME / Jam & Menit clearBuffer(); access = true; } else if (Key == 'U') { // Tombol Up //access = false; Key = 0; goto setBujur; access = false; Key = 0; goto setZonaWaktu; } else if (Key == 'D') { // Tombol Down access = false; Key = 0; goto setDATE; } else if (Key == 'E') { // Tombol Exit access = false; Key = 0; goto endSetting; } Key = 0; // Hapus Data Key if (access) { now = rtc.now(); val = String(charBuffer).toInt(); rtc.adjust(DateTime(now.year(), now.month(), now.day(), jam, mnt, now.second())); //Hanya setting RTC pada variabel Jam dan menit saja if (val < 10) { jam = 0; mnt = val; } else if (val < 100) { jam = 0; mnt = val; } else { jam = val / 100; mnt = val % 100; } } else { readVarRTC(); jam = now.hour(); mnt = now.minute(); } digitalWrite(Latch, LOW); //Mulai set data untuk DISPLAY BESAR //clearDigitDisplay(14, LOW); //clearDigitDisplay(10, LOW); //Setelah tombol Delete / Recall ditekan, nol kan semua digit display besar clearDigitDisplay(6, LOW); //printDate(now.day(), now.month(), now.year()); //printTime(0, 0); //delay(1000); //printDate(now.day(), now.month(), now.year()); printTime(jam, mnt); //delay(200); digitalWrite(Latch, HIGH); goto setTIME; //************************************************************************************* Setting Date setDATE: //inputSetting(8); inputSetting(6); tBlink.update(); if (Key == 'C') { // Tombol Delete clearBuffer(); access = true; } else if (Key == 'U') { // Tombol Up access = false; Key = 0; goto setTIME; } else if (Key == 'D') { // Tombol Down access = false; Key = 0; goto setJedaSubuh; } else if (Key == 'E') { // Tombol Exit access = false; Key = 0; goto endSetting; } Key = 0; // Hapus Data Key if (!access) { readVarRTC(); tgl = now.day(); bln = now.month(); thn = now.year(); } else { val = String(charBuffer).toInt(); if (val < 10 or val < 100) { // or val < 1000 or val < 10000) { tgl = 0; bln = 0; thn = val; } else if (val < 1000 or val < 10000) { //(val < 100000 or val < 1000000) { tgl = 0; bln = val / 100; thn = val % 100; } else if (val < 100000 or val < 1000000) { //tgl = val / 1000000; bln = (val % 1000000) / 10000 ; thn = val % 10000; tgl = val / 10000; bln = (val % 10000) / 100 ; thn = val % 100; } //else //{ //tgl = val / 10000; bln = (val % 10000) / 100 ; thn = val % 100; //} now = rtc.now(); //rtc.adjust(DateTime(thn, bln, tgl, now.hour(), now.minute(), now.second())); thn += 2000; rtc.adjust(DateTime(thn, bln, tgl, now.hour(), now.minute(), now.second())); } digitalWrite(Latch, LOW); //clearDigitDisplay(4, LOW); printDate(tgl, bln, thn); clearDigitJam(4, LOW); digitalWrite(Latch, HIGH); goto setDATE; //************************************************************************************* Setting Jeda Subuh setJedaSubuh: readAllEEPROM(); inputSetting(2); if (Key == 'C') { // Tombol Delete clearBuffer(); access = true; } else if (Key == 'U') { // Tombol Up access = false; Key = 0; goto setDATE; } else if (Key == 'D') { // Tombol Down access = false; Key = 0; goto setJedaDhuhur; } else if (Key == 'E') { // Tombol Exit access = false; Key = 0; goto endSetting; } Key = 0; // Hapus Data Key if (access) { val = String(charBuffer).toInt(); eeprom_write_byte((uint8_t*)0, val); } else { val = jedaIqomah[0]; } digitalWrite(Latch, LOW); //shiftLedJWS(7); //Nyalakan led titik dua (:) digit jam sholat //printRibuan(val); //Nilai digit JWS tampilJWSWkt(16, val); printText(5); //-SUbUh- printText2(0); //JEdA digitalWrite(Latch, HIGH); goto setJedaSubuh; //********************************************************************************** Setting Jeda Dhuhur setJedaDhuhur: readAllEEPROM(); inputSetting(2); if (Key == 'C') { // Tombol Delete clearBuffer(); access = true; } else if (Key == 'U') { // Tombol Up access = false; Key = 0; goto setJedaSubuh; } else if (Key == 'D') { // Tombol Down access = false; Key = 0; goto setJedaAshar; } else if (Key == 'E') { // Tombol Exit access = false; Key = 0; goto endSetting; } Key = 0; // Hapus Data Key if (access) { val = String(charBuffer).toInt(); eeprom_write_byte((uint8_t*)1, val); } else { val = jedaIqomah[1]; } digitalWrite(Latch, LOW); //shiftLedJWS(7); //Nyalakan led titik dua (:) digit jam sholat //printRibuan(val); //tampilJWSWkt(16, val); tampilJWSWkt(12, val); printText(6); printText2(0); digitalWrite(Latch, HIGH); goto setJedaDhuhur; //********************************************************************************** Setting Jeda Ashar setJedaAshar: readAllEEPROM(); inputSetting(2); if (Key == 'C') { // Tombol Delete clearBuffer(); access = true; } else if (Key == 'U') { // Tombol Up access = false; Key = 0; goto setJedaDhuhur; } else if (Key == 'D') { // Tombol Down access = false; Key = 0; goto setJedaMaghrib; } else if (Key == 'E') { // Tombol Exit access = false; Key = 0; goto endSetting; } Key = 0; // Hapus Data Key if (access) { val = String(charBuffer).toInt(); eeprom_write_byte((uint8_t*)2, val); } else { val = jedaIqomah[2]; } digitalWrite(Latch, LOW); //shiftLedJWS(7); //Nyalakan led titik dua (:) digit jam sholat //printRibuan(val); //tampilJWSWkt(16, val); //tampilJWSWkt(12, val); tampilJWSWkt(8, val); printText(7); printText2(0); digitalWrite(Latch, HIGH); goto setJedaAshar; //********************************************************************************** Setting Jeda Maghrib setJedaMaghrib: readAllEEPROM(); inputSetting(2); if (Key == 'C') { // Tombol Delete clearBuffer(); access = true; } else if (Key == 'U') { // Tombol Up access = false; Key = 0; goto setJedaAshar; } else if (Key == 'D') { // Tombol Down access = false; Key = 0; goto setJedaIsya; } else if (Key == 'E') { // Tombol Exit access = false; Key = 0; goto endSetting; } Key = 0; // Hapus Data Key if (access) { val = String(charBuffer).toInt(); eeprom_write_byte((uint8_t*)3, val); } else { val = jedaIqomah[3]; } digitalWrite(Latch, LOW); //tampilJWSWkt(16, val); //tampilJWSWkt(12, val); //tampilJWSWkt(8, val); tampilJWSWkt(4, val); printText(8); printText2(0); digitalWrite(Latch, HIGH); goto setJedaMaghrib; //********************************************************************************** Setting Jeda Isya setJedaIsya: readAllEEPROM(); inputSetting(2); if (Key == 'C') { // Tombol Delete clearBuffer(); access = true; } else if (Key == 'U') { // Tombol Up access = false; Key = 0; goto setJedaMaghrib; } else if (Key == 'D') { // Tombol Down access = false; Key = 0; goto setJedaJumat; } else if (Key == 'E') { // Tombol Exit access = false; Key = 0; goto endSetting; } Key = 0; // Hapus Data Key if (access) { val = String(charBuffer).toInt(); eeprom_write_byte((uint8_t*)4, val); } else { val = jedaIqomah[4]; } digitalWrite(Latch, LOW); //tampilJWSWkt(16, val); //tampilJWSWkt(12, val); //tampilJWSWkt(8, val); //tampilJWSWkt(4, val); tampilJWSWkt(0, val); printText(9); printText2(0); digitalWrite(Latch, HIGH); goto setJedaIsya; //********************************************************************************** Setting Jeda Jumat setJedaJumat: readAllEEPROM(); inputSetting(2); if (Key == 'C') { // Tombol Delete clearBuffer(); access = true; } else if (Key == 'U') { // Tombol Up access = false; Key = 0; goto setJedaIsya; } else if (Key == 'D') { // Tombol Down access = false; Key = 0; goto setJedaMati; } else if (Key == 'E') { // Tombol Exit access = false; Key = 0; goto endSetting; } Key = 0; // Hapus Data Key if (access) { val = String(charBuffer).toInt(); eeprom_write_byte((uint8_t*)5, val); } else { val = jedaJumat; } digitalWrite(Latch, LOW); tampilJWSWkt(12, val); printText(10); printText2(0); digitalWrite(Latch, HIGH); goto setJedaJumat; //********************************************************************************** Setting Jeda Mati setJedaMati: readAllEEPROM(); inputSetting(2); if (Key == 'C') { // Tombol Delete clearBuffer(); access = true; } else if (Key == 'U') { // Tombol Up access = false; Key = 0; goto setJedaJumat; } else if (Key == 'D') { // Tombol Down access = false; Key = 0; goto setJedaAdzan; } else if (Key == 'E') { // Tombol Exit access = false; Key = 0; goto endSetting; } Key = 0; // Hapus Data Key if (access) { val = String(charBuffer).toInt(); eeprom_write_byte((uint8_t*)6, val); } else { val = jedaMati; } digitalWrite(Latch, LOW); tampilJWSWkt(30, val); printText(11); printText2(0); digitalWrite(Latch, HIGH); goto setJedaMati; //********************************************************************************** Setting Jeda Adzan setJedaAdzan: readAllEEPROM(); inputSetting(2); if (Key == 'C') { // Tombol Delete clearBuffer(); access = true; } else if (Key == 'U') { // Tombol Up access = false; Key = 0; goto setJedaMati; } else if (Key == 'D') { // Tombol Down access = false; Key = 0; goto setSelisihWaktu; } else if (Key == 'E') { // Tombol Exit access = false; Key = 0; goto endSetting; } Key = 0; // Hapus Data Key if (access) { val = String(charBuffer).toInt(); eeprom_write_byte((uint8_t*)9, val); } else { val = jedaAdzan; } digitalWrite(Latch, LOW); tampilJWSWkt(31, val); printText(12); printText2(0); digitalWrite(Latch, HIGH); goto setJedaAdzan; //********************************************************************************** Setting Selisih Waktu setSelisihWaktu: readAllEEPROM(); inputSetting(2); if (Key == 'C') { // Tombol Delete clearBuffer(); access = true; } else if (Key == 'U') { // Tombol Up access = false; Key = 0; goto setJedaAdzan; } else if (Key == 'D') { // Tombol Down access = false; Key = 0; goto setZonaWaktu; } else if (Key == 'E') { // Tombol Exit access = false; Key = 0; goto endSetting; } Key = 0; // Hapus Data Key if (access) { val = String(charBuffer).toInt(); eeprom_write_byte((uint8_t*)7, val); } else { val = selisihWaktu; } digitalWrite(Latch, LOW); //shiftLedJWS(7); //printRibuan(val); //printText(14); //printText(4); tampilJWSWkt(32, val); printText(14); printText2(4); digitalWrite(Latch, HIGH); goto setSelisihWaktu; //********************************************************************************** Setting Zona waktu setZonaWaktu: readAllEEPROM(); inputSetting(2); if (Key == 'C') { // Tombol Delete clearBuffer(); access = true; } else if (Key == 'U') { // Tombol Up access = false; Key = 0; goto setSelisihWaktu; } else if (Key == 'D') { // Tombol Down //access = false; Key = 0; goto setLintang; for (int i=0; i<=5; i++) { if (i==0) { a = 6; } else if (i==1) { a = 5; } else if (i==2) { a = 3; } else if (i==3) { a = 2; } else if (i==4) { a = 0; } else { a = 8; } //clearDigitDisplay2(24, LOW); //Serial.println("Jalankan fungsi slideShowJWS()"); slideShowJWS(); //modifikasi 1, disable sintax utk data digit d13-d17, krn hardware JWS Masjid sei. kakap berbeda //delay(4000); } access = false; Key = 0; goto setTIME; } else if (Key == 'E') { // Tombol Exit access = false; Key = 0; goto endSetting; } Key = 0; // Hapus Data Key if (access) { val = String(charBuffer).toInt(); eeprom_write_byte((uint8_t*)8, val); } else { val = zonaWaktu; } digitalWrite(Latch, LOW); //shiftLedJWS(7); //printRibuan(val); //printText(13); //printText(4); tampilJWSWkt(33, val); printText(13); printText2(4); digitalWrite(Latch, HIGH); goto setZonaWaktu; //********************************************************************************** Setting Lintang /* setLintang: readAllEEPROM(); if (remote.decode(&valRemote)) { Key = keyChar(valRemote.value); remote.resume(); Serial.print("Tombol yang diketik (keyChar): "); Serial.println(Key); Serial.print("Tombol yang diketik (valRemote): "); Serial.println(valRemote.value); } if (Key == 'C') { // Tombol Delete clearBuffer(); access = true; titik = false; ttk = 0; val = 0;; } else if (Key == 'U') { // Tombol Up access = false; titik = false; Key = 0; goto setZonaWaktu; } else if (Key == 'D') { // Tombol Down access = false; titik = false; Key = 0; goto setBujur; } else if (Key == 'E') { // Tombol Exit access = false; titik = false; Key = 0; goto endSetting; } else if (Key == '.') { // Tombol Exit titik = true; charBuffer[n] = Key; n++; Key = 0; } if (access) { if (!titik) { if (n < 6) { if (Key) { if (Key >= 48 and Key <= 57 or Key == '-' or Key == '.') { charBuffer[n] = Key; n++; } } } val = String(charBuffer).toInt(); } else { if (a < 2) { if (Key) { if (Key >= 48 and Key <= 57) { charBuffer[n] = Key; floatBuff[a] = Key; a++; n++; } } } ttk = String(floatBuff).toInt(); String(floatBuff) = ""; } eeprom_write_float((float*)10, String(charBuffer).toFloat()); } else { val = lintang; ttk = abs((lintang - val) * 100); } Serial.print("Nilai val: "); Serial.println(val); delay(1000); Key = 0; // Hapus Data Key digitalWrite(Latch, LOW); //shiftLedJWS(7); //printText(15); //printPuluhan(ttk); //printGeo(val); //printText(4); tampilJWSWkt(34, val); printGeo(val); printText2(4); digitalWrite(Latch, HIGH); goto setLintang; */ //********************************************************************************** Setting Bujur /* setBujur: readAllEEPROM(); if (remote.decode(&valRemote)) { Key = keyChar(valRemote.value); remote.resume(); } if (Key == 'C') { // Tombol Delete clearBuffer(); access = true; titik = false; ttk = 0; val = 0;; } else if (Key == 'U') { // Tombol Up access = false; titik = false; Key = 0; goto setLintang; } else if (Key == 'D') { // Tombol Down access = false; titik = false; Key = 0; goto setTIME; } else if (Key == 'E') { // Tombol Exit access = false; titik = false; Key = 0; goto endSetting; } else if (Key == '.') { // Tombol Exit titik = true; charBuffer[n] = Key; n++; Key = 0; } if (access) { if (!titik) { if (n < 6) { if (Key) { if (Key >= 48 and Key <= 57 or Key == '-' or Key == '.') { charBuffer[n] = Key; n++; } } } val = String(charBuffer).toInt(); } else { if (a < 2) { if (Key) { if (Key >= 48 and Key <= 57) { charBuffer[n] = Key; floatBuff[a] = Key; a++; n++; } } } ttk = String(floatBuff).toInt(); String(floatBuff) = ""; } eeprom_write_float((float*)15, String(charBuffer).toFloat()); } else { val = bujur; ttk = abs((bujur - val) * 100); } Key = 0; // Hapus Data Key digitalWrite(Latch, LOW); //shiftLedJWS(7); //printText(16); //printPuluhan(ttk); //printGeo(val); //printText(4); tampilJWSWkt(35, val); printGeo(val); printText2(4); digitalWrite(Latch, HIGH); goto setBujur; */ //********************************************************************************** End Setting endSetting: setting = false; } //==================================================================================================================
Demikian sketch-sketch yang dignakan untuk JWS ini. Adapun sketch untuk mempermudah kita melakukan Dumping kode dari tombol-tombol remote tv universal (disini saya menggunakan protokol samsung dengan kode 050), sebagai berikut:
#include <IRremote.h> //int RECV_PIN = 11; // PIN 11 int RECV_PIN = 11; // PIN 2 IRrecv irrecv(RECV_PIN); decode_results results; int incomingByte; void setup() { Serial.begin(9600); irrecv.enableIRIn(); } void loop() { while(Serial.available()) { } for (int i=0; i<24; i++) { if (i<10) { delay(1000); Serial.print("Tekan tombol "); Serial.print(i); Serial.println(" :"); delay(400); while (!irrecv.decode(&results)) { } Serial.println(results.value); delay(400); irrecv.resume(); } else { switch (i) { case (10): Serial.println("Tekan tombol titik (.) :"); break; case (11): Serial.println("Tekan tombol + :"); break; case (12): Serial.println("Tekan tombol - :"); break; case (13): Serial.println("Tekan tombol Power :"); break; case (14): Serial.println("Tekan tombol OK :"); break; case (15): Serial.println("Tekan tombol Panah Atas :"); break; case (16): Serial.println("Tekan tombol Panah Bawah :"); break; case (17): Serial.println("Tekan tombol Panah Kiri :"); break; case (18): Serial.println("Tekan tombol Panah Kanan :"); break; case (19): Serial.println("Tekan tombol Recall :"); break; case (20): Serial.println("Tekan tombol Exit :"); break; case (21): Serial.println("Tekan tombol CH+ :"); break; case (22): Serial.println("Tekan tombol CH- :"); break; case (23): Serial.println("Tekan tombol Menu :"); break; default: break; } delay(400); while (!irrecv.decode(&results)) { } Serial.println(results.value); delay(400); irrecv.resume(); } } }
Demikian artikel kali ini, semoga bermanfaat. Jangan lupa untuk SUBSCRIBE, LIKE, SHARE dan COMMENT pada channel youtube kami, agar bisa selalu update dan berkembang.
Terima kasih.
Izin save mas����
BalasHapusOkey
HapusMas untuk byte ledjws diambil darimana?
BalasHapusIzin save , moga barokah
BalasHapusLagi belajar ga' jadi jadi pusing... Kalau ada sket yg menggunakan Esp12f...
BalasHapusSir please share Circuit Diagram
BalasHapusim from pakistan i cannot understand your languge please share circuite diagram i hope i can understand
BalasHapus