Senin, 18 April 2016

Latihan Lima

Mari Belajar EEPROM yang ada di arduino

Dalam kesempatan ini marilah kita belajar latihan dasar dalam memanfaatkan eeprom yang ada di mikrokontroller arduino. Contoh latihan dasar penggunaan EEPROM ada pada Ide Arduino


ada 3 contoh latihan dasar yang dapat dicoba  oleh kita. cobalah satu persatu. inti dari 3 contoh program yang ada adalah bagaimana kita bisa menulis data pada eeprom dan bagaimana kita membaca data dari eeprom. Mungkin dari kita ada yag bertanya tanya apa perlunya eeprom.

Selasa, 15 Desember 2015

Latihan Pengendalian lampu Led



 Pertama-tama marilah kita berlatih dasar yaitu menampilkan jam di layar lcd. 

Listing programnya adalah sebagai Berikut  :

--------------------------------------------------------

#include <LiquidCrystal.h>
LiquidCrystal lcd(43, 45, 47, 49,51,53); // RS,E,D4,D5,D6,D7

#include "Wire.h"
#define DS1307_ADDRESS 0x68
int d,m,j,hk,bl,th,tg, hd;
void setup() {
    Wire.begin();
        lcd.begin(16,2);
  pinMode (18,OUTPUT); digitalWrite(18,0); // Untuk Memberi Tegangan 0 Volt ke RTC
 pinMode (19,OUTPUT); digitalWrite(19,1);  // Untuk Memberi Tegangan 5 Volt ke RTC
}

void loop() {

  Wire.beginTransmission(DS1307_ADDRESS);
  byte zero = 0x00;
  Wire.write(zero);
  Wire.endTransmission();
  Wire.requestFrom(DS1307_ADDRESS, 7);
   d = bcdToDec(Wire.read());
  m = bcdToDec(Wire.read());
  j = bcdToDec(Wire.read() & 0b111111); //24 hour time
  hk = bcdToDec(Wire.read()); //0-6 -> sunday - Saturday
  tg = bcdToDec(Wire.read());
  bl = bcdToDec(Wire.read());
  th = bcdToDec(Wire.read());
 if ( hd != d){
   hd = d ;
  String waktuu = "< "+ String (j/10)+String (j%10)+":"+ String (m/10) +String (m%10)+ ":"+String (d/10)+String (d%10)+" WIB >" ;
   lcd.clear() ;
  lcd.setCursor(0,0);
  lcd.print(waktuu); }
}

byte bcdToDec(byte val)  {
// Convert binary coded decimal to normal decimal numbers
  return ( (val/16*10) + (val%16) );
}

byte decToBcd(byte val){
// Convert normal decimal numbers to binary coded decimal
  return ( (val/10*16) + (val%10) );
}




--------------------------------------------------------




Nah  Sekarang cobalah latihan dengan baris program di bawah ini.



----------------------------------------------------------
 
#include <LiquidCrystal.h>
LiquidCrystal lcd(43, 45, 47, 49,51,53); // RS,E,D4,D5,D6,D7

#include "Wire.h"
#define DS1307_ADDRESS 0x68
byte zero = 0x00; //workaround for issue #527

int d,m,j,hk,bl,th,tg ;
int k=1 ; int tm=1;
int ta=9 ; int tb=8; int tc=7;
String hari;
void setup() {
    Wire.begin();
    lcd.begin(16,2);
  pinMode(ta,INPUT); pinMode(tb,INPUT);pinMode(tc,INPUT);
   pinMode (18,OUTPUT); digitalWrite(18,0); // Untuk Memberi Tegangan 0 Volt ke RTC
 pinMode (19,OUTPUT); digitalWrite(19,1);  // Untuk Memberi Tegangan 5 Volt ke RTC

}

void loop() {
 if (k==1) {
  Wire.beginTransmission(DS1307_ADDRESS);
  byte zero = 0x00;
  Wire.write(zero);
  Wire.endTransmission();
  Wire.requestFrom(DS1307_ADDRESS, 7);
   d = bcdToDec(Wire.read());
  m = bcdToDec(Wire.read());
  j = bcdToDec(Wire.read() & 0b111111); //24 hour time
  hk = bcdToDec(Wire.read()); //0-6 -> sunday - Saturday
  tg = bcdToDec(Wire.read());
  bl = bcdToDec(Wire.read());
  th = bcdToDec(Wire.read());
    delay (233);

  String waktuu = "Jam :" + String (j/10)+String (j%10)+":"+String (m/10)+ String (m%10)+":"+String (d/10)+String (d%10) ;
  String waktu2 = "1.Atur Jam" ;
   lcd.clear() ;
  lcd.setCursor(0,0);
  lcd.print(waktuu);
  lcd.setCursor(0,1);
  lcd.print(waktu2);
 
  if (digitalRead (ta) ==1 ) {  k=2; delay (400); }
 }

if (k==2) {
if (tm==1){
  lcd.clear ();
  lcd.setCursor(0,0);
  lcd.print(" Merubah Jam ");
  lcd.setCursor(0,1);
  lcd.print("1. Ya   2. Tidak ");
if (digitalRead (tb)==1) { delay (100); k=1; }
if (digitalRead (ta)==1) {delay (100);   tm=2;}
delay (100);

}
if (tm==2){
  lcd.clear ();
  lcd.setCursor(0,0);
  lcd.print("Jam : "); lcd.print (j);
  lcd.setCursor(0,1);
  lcd.print("1= +  2= -  3=OK");
if (digitalRead (ta)==1) {
   j=j+1; delay (100);
   if (j>23 ) j=0; }
if (digitalRead (tb)==1) {
   j=j-1; delay (100);
   if ( j < 0 ) j=23 ;  }
if (digitalRead (tc)==1) {tm=3; delay (100); }
 
  delay(300); ;
}

if (tm==3){
  lcd.clear ();
  lcd.setCursor(0,0);
  lcd.print("Menit : "); lcd.print (String (m/10)+ String (m%10));
  lcd.setCursor(0,1);
  lcd.print("1= +  2= -  3=OK");
if (digitalRead (ta)==1) {
    m=m+1; delay (100);
    if (m > 59) m=0;}
if (digitalRead (tb)==1) {
    m=m-1; delay (100);
    if (m<0) m=59; }
if (digitalRead (tc)==1) {tm=4; delay (100); }
delay(100); ;
}

if (tm==4){
  lcd.clear ();
  lcd.setCursor(0,0);
  lcd.print("Data Disimpan");
  lcd.setCursor(0,1);
  lcd.print("1= Ya    2= Tidak");
if (digitalRead (ta)==1) {
  Wire.beginTransmission(DS1307_ADDRESS);
  Wire.write(zero); //stop Oscillator

  Wire.write(decToBcd(10));
  Wire.write(decToBcd(m));
  Wire.write(decToBcd(j));
  Wire.write(decToBcd(hk));
  Wire.write(decToBcd(tg));
  Wire.write(decToBcd(bl));
  Wire.write(decToBcd(th));

  Wire.write(zero); //start

  Wire.endTransmission();

delay (100);
tm=1; k=1;
}
if (digitalRead (tb)==1) { tm=1; k=1; }
delay(100); ;
}

}
}

byte bcdToDec(byte val)  {
// Convert binary coded decimal to normal decimal numbers
  return ( (val/16*10) + (val%16) );
}

byte decToBcd(byte val){
// Convert normal decimal numbers to binary coded decimal
  return ( (val/10*16) + (val%10) );

}

--------------------------------------------------------







 





Selasa, 10 November 2015

Jadwal Shalat dengan Arduino

Sambungan dari Latihan Empat

Halaman ini adalah halaman sambungan dari alamat  http://sukrifsi.blogspot.co.id/2015/11/latihan-empat.html  bila saudara belum mengunjunginya silahkan kunjungi terlebih dahulu pendahuluan dari latihan pembuatan alat ini dengan menekan link yang ada di atas.
Nah untuk membuat Jadwal Sholat yang kita perlukan adalah  :
- Mikrokontroller Arduino
- Lcd 16x2  karakter
- RTC
- Rangkaian Saklar input

Rangkaiannya adalah sebagai Berikut yaaaa....


Setelah diramgkai seperti di atas langkah berikutnya adalah menulis programnya. 
ini adalah list program jadwal sholat versi 1.

 ----------------------------------------------------------------------------------------



#include <LiquidCrystal.h>
LiquidCrystal lcd(43, 45, 47, 49,51,53); // RS,E,D4,D5,D6,D7

#include "Wire.h"
#define DS1307_ADDRESS 0x68
byte zero = 0x00; //workaround for issue #527
int tb;
int i,s,z,a,m ;
int d3,d2,d,mn,j,hk,bl,th,tg,tg2 ;
int k=1 ; int tm=1;
int ta=9 ; int tbb=8; int tc=7;
String hari;
String waktuu,waktu2;
void setup() {
    Wire.begin();
    lcd.begin(16,2);
  pinMode(ta,INPUT); pinMode(tbb,INPUT);pinMode(tc,INPUT);
   pinMode (18,OUTPUT); digitalWrite(18,0); // Untuk Memberi Tegangan 0 Volt ke RTC
 pinMode (19,OUTPUT); digitalWrite(19,1);  // Untuk Memberi Tegangan 5 Volt ke RTC

}

void loop() {
 if (k==1) {
  Wire.beginTransmission(DS1307_ADDRESS);
  byte zero = 0x00;
  Wire.write(zero);
  Wire.endTransmission();
  Wire.requestFrom(DS1307_ADDRESS, 7);
   d = bcdToDec(Wire.read());
  mn = bcdToDec(Wire.read());
  j = bcdToDec(Wire.read() & 0b111111); //24 hour time
  hk = bcdToDec(Wire.read()); //0-6 -> sunday - Saturday
  tg = bcdToDec(Wire.read());
  bl = bcdToDec(Wire.read());
  th = bcdToDec(Wire.read());
    delay (233);

if (d2!= d) {d2= d ; d3 = d3 + 1;
  if (d3 > 16 ) d3=0; }
int ji =i/100; int mi =i%100; int jz =z/100; int mz =z %100; 
int ja =a/100; int ma =a %100; int jm =m/100; int mm =m %100; 
int js =s/100; int ms =s %100; 
  waktuu = "Jam : " + String (j/10)+String (j%10)+":"+String (mn/10)+ String (mn %10)+":"+String (d/10)+String (d%10) ;
if (d3==3 )    waktu2 = "Isya : " + String(ji/10)+ String(ji%10) + ":" +String(mi/10)+ String(mi%10) ; 
if (d3==5 )    waktu2 = "Subuh : " + String(js/10)+ String(js%10) + ":"+String(ms/10)+ String(ms %10) ; 
if (d3==7 )    waktu2 = "Zuhur : " + String(jz/10)+ String(jz%10) + ":"+String(mz/10)+ String(mz %10) ; 
if (d3==9 )    waktu2 = "Asar : " + String(ja/10)+ String(ja%10) + ":"+String(ma/10)+ String(ma%10) ; 
if (d3==11 )    waktu2 = "Magrib : " + String(jm/10)+ String(jm%10) + ":"+String(mm/10)+ String(mm %10) ; 
if (d3==1 )    waktu2 = "Jadwal Shalat " ; 
if (d3==13 )    waktu2 = "Tb 1. Seting Jam"; 
if (d3==15 )    waktu2 = "Tgl : "+ String(tg)+"-"+ String (bl)+ "-20"+String(th); 
   lcd.clear() ;
  lcd.setCursor(0,0);
  lcd.print(waktuu);
  lcd.setCursor(0,1);
  lcd.print(waktu2); delay(222);
  
  if (digitalRead (ta) ==1 ) {  k=2; delay (200); }
 }

  if (hk==0) hari="Minggu" ;
  if (hk==1) hari="Senin" ;
  if (hk==2) hari="Selasa" ;
  if (hk==3) hari="Rabu" ;
  if (hk==4) hari="Kamis" ;
  if (hk==5) hari="Jum'at" ;
  if (hk==6) hari="Saptu" ;


if (k==2) {
if (tm==1){
  lcd.clear ();
  lcd.setCursor(0,0);
  lcd.print(" Merubah Waktu ");
  lcd.setCursor(0,1);
  lcd.print("1. Ya   2. Tidak ");
if (digitalRead (tbb)==1) { delay (100); k=1; }
if (digitalRead (ta)==1) {delay (100);   tm=2;}
delay (500);

}
if (tm==2){
  lcd.clear ();
  lcd.setCursor(0,0);
  lcd.print("Jam : "); lcd.print (j);
  lcd.setCursor(0,1);
  lcd.print("1= +  2= -  3=OK");
if (digitalRead (ta)==1) { j=j+1; delay (100); }
if (digitalRead (tbb)==1) { j=j-1; delay (100); }
if (digitalRead (tc)==1) {tm=3; delay (100); }
 if (j>23) j=0;
 if (j<0) j=23;
  delay(300); ;
}

if (tm==3){
  lcd.clear ();
  lcd.setCursor(0,0);
  lcd.print("Menit : "); lcd.print (String (mn/10)+ String (mn %10));
  lcd.setCursor(0,1);
  lcd.print("1= +  2= -  3=OK"); 
if (digitalRead (ta)==1) { mn=mn+1; delay (100); }
if (digitalRead (tbb)==1) { mn=mn-1; delay (100); }
if (digitalRead (tc)==1) {tm=4; delay (100); }
 if (mn>59) mn=0;
 if (mn<0) mn=59;

delay(200); ;
}
if (tm==4){
  lcd.clear ();
  lcd.setCursor(0,0);
  lcd.print("Hari : "); lcd.print (hari);
  lcd.setCursor(0,1);
  lcd.print("1= +  2= -  3=OK"); 
if (digitalRead (ta)==1) { hk=hk+1; delay (100); }
if (digitalRead (tbb)==1) { hk=hk-1; delay (100); }
if (digitalRead (tc)==1) {tm=5; delay (100); }
 if (hk>6) hk=0;
 if (hk<0) hk=6;

delay(200); ;
}

if (tm==5){
  lcd.clear ();
  lcd.setCursor(0,0);
  lcd.print("Tanggal : "); lcd.print (tg);
  lcd.setCursor(0,1);
  lcd.print("1= +  2= -  3=OK"); 
if (digitalRead (ta)==1) { tg=tg+1; delay (100); }
if (digitalRead (tbb)==1) { tg=tg-1; delay (100); }
if (digitalRead (tc)==1) {tm=6; delay (100); }
 if (tg>31) tg=0;
 if (tg<0) tg=31;
delay(200); ;
}

if (tm==6){
  lcd.clear ();
  lcd.setCursor(0,0);
  lcd.print("Bulan : "); lcd.print (bl);
  lcd.setCursor(0,1);
  lcd.print("1= +  2= -  3=OK"); 
if (digitalRead (ta)==1) { bl=bl+1; delay (100); }
if (digitalRead (tbb)==1) { bl=bl-1; delay (100); }
if (digitalRead (tc)==1) {tm=7; delay (100); }
 if (bl>12) bl=1;
 if (bl<1) bl=12;
delay(200); ;
}
if (tm==7){
  lcd.clear ();
  lcd.setCursor(0,0);
  lcd.print("Tahun : "); lcd.print (th);
  lcd.setCursor(0,1);
  lcd.print("1= +  2= -  3=OK"); 
if (digitalRead (ta)==1) { th=th+1; delay (100); }
if (digitalRead (tbb)==1) { th=th-1; delay (100); }
if (digitalRead (tc)==1) {tm=8; delay (100); }
delay(200); ;
}

if (tm==8){
  lcd.clear ();
  lcd.setCursor(0,0);
  lcd.print("Data Disimpan"); 
  lcd.setCursor(0,1);
  lcd.print("1= Ya    2= Tidak"); 
if (digitalRead (ta)==1) { 
  Wire.beginTransmission(DS1307_ADDRESS);
  Wire.write(zero); //stop Oscillator

  Wire.write(decToBcd(d));
  Wire.write(decToBcd(mn));
  Wire.write(decToBcd(j));
  Wire.write(decToBcd(hk));
  Wire.write(decToBcd(tg));
  Wire.write(decToBcd(bl));
  Wire.write(decToBcd(th));
  Wire.write(zero); //start 
  Wire.endTransmission();

delay (100);
tm=1; k=1;
}
if (digitalRead (tbb)==1) { tm=1; k=1; }
delay(200); ;
}
}
// Mengecek jadwal Shalat 
// Data di update Setiap Hari 
if (tg2!= tg) {
  tg2 = tg;
  tb = (bl*100) + tg ;
  if (tb==101 ||tb==102 || tb==103 ||tb== 104 || tb==105 ) { i= 1916 ; s=409 ; z=1146; a=1510; m=1802; }
if (tb==106 || tb==107 || tb== 108 || tb== 109 || tb==110 ){i=1920; s=411 ; z= 1149; a= 1514; m= 1805; }
if (tb==111 || tb==112 || tb== 113 || tb== 114 || tb==115 ) {i=1921; s=414; z=1151; a=1515; m=1807; }
if (tb==116 || tb==117 || tb== 118 || tb== 119 || tb==120 ) {i=1921; s=417; z=1153; a=1516; m=1808;}
if (tb==121 || tb==122 || tb== 123 || tb== 124 || tb==125 ){ i=1922; s=420; z=1154; a=1516; m=1809;}
if (tb==126 || tb==127 || tb== 128 || tb== 129 || tb==130 ){ i=1922; s=422; z=1155; a=1515; m=1809;}
if (tb==131 || tb==201 || tb== 202 || tb== 203 ){ i=1922; s=424; z=1156; a=1514; m=1809;}
if (tb==204  || tb==205 || tb== 206 || tb== 207 ||tb== 207  ){i=1918; s=426 ; z=1156 ; a=1512; m=1808;}
if (tb==209 || tb==210 || tb== 211 || tb== 212 || tb==213) { i=1917;  s= 427; z= 1156; a= 1510; m= 1807 ;}
if (tb==214 || tb==215 || tb== 216 || tb== 217 || tb==218) { i=1915; s= 429; z=1156; a=1508; m=1806; }
if (tb==219 || tb==220 || tb== 221 || tb== 222 || tb==223) { i=1914; s= 431; z=1156; a=1504; m=1805;}
if (tb==224 || tb==225 || tb== 226 || tb== 227 || tb==228 || tb==29 ) {i=1913; s= 432; z=1155; a=1500; m=1803;}
if (tb==301 || tb==302 || tb== 303 || tb== 304 || tb==305) {i=1910; s= 432; z=1154; a=1457; m=1801;}
if (tb==306 || tb==307 || tb== 308 || tb== 309 || tb==310) {i=1908; s=432; z=1153; a=1459; m=1759;}
if (tb==311 || tb==311 || tb== 312 || tb== 313 || tb==311 || tb==315) {i=1905; s=433; z=1152; a=1501; m=1757;}
if (tb==316 || tb==317 || tb== 318 || tb== 319 || tb==320 ){i=1903; s=432; z=1150; a=1501; m=1754;}
if (tb==312 || tb==322 || tb== 323 || tb== 324 || tb==325 ){i=1900; s=432; z=1149; a=1502; m=1752;}
if (tb==326 || tb==311 || tb== 327 || tb== 328 || tb==329|| tb==330|| tb==331  ){i=1858; s=431; z=1147; a=1502; m=1749;}
if (tb==401 || tb==402 || tb== 403 || tb== 404 || tb==405 ){i=1855; s=430; z=1147; a=1503; m=1747;}
if (tb==406 || tb==407 || tb== 408 || tb== 409 || tb==410 ){i=1852; s=429; z=1144; a=1502; m=1744;}
if (tb==411 || tb==412 || tb== 413 || tb== 414 || tb==415 ){i=1851; s=429; z=1143; a=1501; m=1742;}
if (tb==416 || tb==416 || tb== 417 || tb== 418 || tb==419|| tb==420 ){ i=1849; s=428; z=1142; a=1501; m=1740;}
if (tb==421 || tb==422 || tb== 423 || tb== 424 || tb==425 ){i=1846; s=427; z=1140; a=1500; m=1737;}
if (tb==426 || tb==427 || tb== 428 || tb== 429 || tb==430 || tb==431 || tb==501 ){i=1845; s=426; z=1139; a=1459; m=1735;}
if (tb==502 || tb==503 || tb== 504 || tb== 505 || tb==506 ){i=1844; s=427; z=1139; a=1459; m=1734;}
if (tb==507 || tb==508 || tb== 509 || tb== 510 || tb==511 ){i=1843; s=426; z=1138; a=1458; m=1732;}
if (tb==512 || tb==513 || tb== 514 || tb== 515 || tb==516 ){i=1843; s=426; z=1138; a=1458; m=1731;}
if (tb==517 || tb==518 || tb== 519 || tb== 505 || tb==520 || tb==521 ){i=1844; s=427; z=1139; a=1459; m=1732;}
if (tb==522 || tb==523 || tb== 524 || tb== 525 || tb==526 ){i=1843; s=427; z=1139; a=1459; m=1731;}
if (tb==527 || tb==528 || tb== 529 || tb== 530 || tb==531 || tb==601 ){i=1844; s=428; z=1140; a=1500; m=1731;}
if (tb==602 || tb==603 || tb== 604 || tb== 605 || tb==606 ){i=1844;  s=429; z=1140; a=1500; m=1731;}
if (tb==607 || tb==608 || tb== 609 || tb== 610 || tb==611 ){i=1845; s=430; z=1141; a=1501; m=1731;}
if (tb==612 || tb==613 || tb== 614 || tb== 615 || tb==616 ){i=1846; s=431; z=1142; a=1502; m=1732;}
if (tb==617 || tb==618 || tb== 618 || tb== 620 || tb==621 ){i=1847; s=432; z=1143; a=1503; m=1733;}
if (tb==622 || tb==623 || tb== 624 || tb== 625 || tb==626 ){i=1848; s=433; z=1144; a=1504; m=1734;}
if (tb==627 || tb==628 || tb== 629 || tb== 630 || tb==631 || tb==701 || tb==702 ){i=1849; s=434; z=1145; a=1504; m=1735;}
if (tb==703 || tb==304 || tb== 705 || tb== 706 || tb==707 ) {i=1850; s=435; z=1146; a=1508; m=1736;}
if (tb==708 || tb==709 || tb== 710 || tb== 711 || tb==712) { i=1851; s=436; z=1147; a=1508; m=1738;}
if (tb==713 || tb==714 || tb== 715 || tb== 716 || tb==717) {i=1852; s=436; z=1148; a=1508; m=1739;}
if (tb==718 || tb==719 || tb== 720 || tb== 721 || tb==722) {i=1852; s=436; z=1148; a=1508; m=1740;}
if (tb==723 || tb==724 || tb== 725 || tb== 726 || tb==727){i=1853; s=436; z=1148; a=1508; m=1741;}
if (tb==728 || tb==729 || tb== 730 || tb== 731 || tb==801 || tb==802){i=1853; s=436; z=1148; a=1508; m=1741;}
if (tb==803 || tb==804 || tb== 805 || tb== 806 || tb==807 ){i=1853; s=436; z=1148; a=1508; m=1742;}
if (tb==808 || tb==809 || tb== 810 || tb== 811 || tb==812 || tb==802){i=1852; s=435; z=1147; a=1507; m=1742;}
if (tb==813 || tb==814 || tb== 814 || tb== 815 || tb==816 || tb==817){i=1852; s=433; z=1146; a=1503; m=1742;}
if (tb==818 || tb==819 || tb== 820 || tb== 821 || tb==822 || tb==823){i=1851; s=432; z=1145; a=1505; m=1742;}
if (tb==824 || tb==825 || tb== 826 || tb== 827 || tb==828 ){i=1851; s=430; z=1144; a=1503; m=1742;}
if (tb==829 || tb==830 || tb== 831 || tb== 901 || tb==902 ){i=1850; s=428; z=1142; a=1500; m=1741;}
if (tb==903 || tb==904 || tb== 905 || tb== 906 || tb==907 ){i=1849; s=426; z=1141; a=1457; m=1741;}
if (tb==908 || tb==909 || tb== 910 || tb== 911 || tb==912 ){i=1848; s=423; z=1139; a=1455; m=1740;}
if (tb==914 || tb==915 || tb== 916 || tb== 917 || tb==913 ){i=1848; s=421; z=1137; a=1452; m=1739;}
if (tb==918 || tb==919 || tb== 920 || tb== 921 || tb==922|| tb==923 ){i=1846; s=418; z=1135; a=1448; m=1738;}
if (tb==924 || tb==925 || tb== 926 || tb== 927 || tb==928|| tb==928){i=1846; s=415; z=1134; a=1444; m=1737;}
if (tb==929 || tb==930 || tb== 931 || tb== 1001 || tb==1003|| tb==1004){i=1846; s=413; z=1132; a=1441; m=1737;}
if (tb==1004 || tb==1005 || tb== 1006 || tb== 1007 || tb==1008){i=1845; s=409; z=1130; a=1436; m=1736;}
if (tb==1009 || tb== 1010 || tb== 1011 || tb==1012|| tb==1013 ){i=1845; s=407; z=1129; a=1432; m=1736;}
if (tb==1014 || tb==1015 || tb== 1016 || tb== 1017 || tb==1018){i=1846; s=405; z=1128; a=1433; m=1736;}
if (tb==1019 || tb==1020 || tb== 1021 || tb== 1022 || tb==1023){i=1845; s=402; z=1127; a=1435; m=1736;}
if (tb==1024 || tb==1025 || tb== 1026 || tb== 1027 || tb==1028 ){i=1845; s=359; z=1126; a=1438; m=1736;}
if (tb==1029 || tb==1030 || tb== 1031 || tb== 1101 || tb==1102 ){i=1847; s=357; z=1126; a=1440; m=1737;}
if (tb==1103 || tb==1104 || tb== 1105 || tb== 1106 || tb==1107 ) {i= 1848; s=356;  z=1126; a=1444; m=1738;}
if (tb==1108 || tb==1109 || tb== 1110 || tb== 1111 || tb==1112){i=1853; s=355; z=1127; a=1445; m=1740;}
if (tb==1113 || tb==1114 || tb== 1115 || tb== 1116 || tb==1117){i=1854; s=354; z=1127; a=1447; m=1741;}
if (tb==1118 || tb==1119 || tb== 1120 || tb== 1121 || tb==1122){i=1856; s=354; z=1128; a=1450; m=1743;}
if (tb==1123 || tb==1124 || tb== 1125 || tb== 1126 || tb==1127){i=1859; s=354; z=1130; a=1453; m=1745;}
if (tb==1128 || tb==1129 || tb== 1130 || tb== 1131 || tb==1201){i=1901; s=354; z=1131; a=1455; m=1747;}
if (tb==1202 || tb==1203 || tb== 1204 || tb== 1205 || tb==1206){i=1904; s=355; z=1133; a=1458; m=1749;}
if (tb==1207 || tb==1208 || tb== 1209 || tb== 1210 || tb==1211){i=1907; s=356; z=1135; a=1500; m=1751;}
if (tb==1212 || tb==1213 || tb== 1214 || tb== 1215 || tb==1216){i=1909; s=357; z=1137; a=1503; m=1754;}
if (tb==1217 || tb==1218 || tb== 1219 || tb== 1220 || tb==1221){i=1911; s=358; z=1139; a=1505; m=1756;}
if (tb==1222 || tb==1223 || tb== 1224 || tb== 1225 || tb==12206){i=1914; s=401; z=1142; a=1508; m=1759;}
if (tb==1227 || tb==1228 || tb== 1229 || tb== 1230 || tb==1231){i=1916; s=403; z=1144; a=1510; m=1801;}
} // akhir pengecekan data bes jadwal shalat

}

byte bcdToDec(byte val)  {
// Convert binary coded decimal to normal decimal numbers
  return ( (val/16*10) + (val%16) );
}

byte decToBcd(byte val){
// Convert normal decimal numbers to binary coded decimal
  return ( (val/10*16) + (val%10) );
}


----------------------------------------------------------------------------------------

Program ini dapat menampilkan jam dan jadwal shalat. tetapi sayangnya hanya satu tempat saja jadi hanya berlaku untuk wilayah Daerah Semarang, Magelang, Yogyakarta, Dan Sekitarnya. Jika Saudara berada di daerah jakarta tentunya alat ini tidak sesuai. oleh karena itu listing programnya harus kita tambah. nah perhatikan listing program di bawah ini

----------------------------------------------------------------------------------------



#include <LiquidCrystal.h>
LiquidCrystal lcd(43, 45, 47, 49,51,53); // RS,E,D4,D5,D6,D7

#include "Wire.h"
#define DS1307_ADDRESS 0x68
byte zero = 0x00; //workaround for issue #527
int pil=1;
String kota;
int tb; int wt = 12 ;
int i,s,z,a,m ;
int d3,d2,d,mn,j,hk,bl,th,tg,tg2 ;
int k=1 ; int tm=1;
int ta=9 ; int tbb=8; int tc=7;
String hari;
String waktuu,waktu2;
void setup() {
    Wire.begin();
    lcd.begin(16,2);
  pinMode(ta,INPUT); pinMode(tbb,INPUT);pinMode(tc,INPUT);
   pinMode (18,OUTPUT); digitalWrite(18,0); // Untuk Memberi Tegangan 0 Volt ke RTC
 pinMode (19,OUTPUT); digitalWrite(19,1);  // Untuk Memberi Tegangan 5 Volt ke RTC

}

void loop() {
 if (k==1) {
  Wire.beginTransmission(DS1307_ADDRESS);
  byte zero = 0x00;
  Wire.write(zero);
  Wire.endTransmission();
  Wire.requestFrom(DS1307_ADDRESS, 7);
   d = bcdToDec(Wire.read());
  mn = bcdToDec(Wire.read());
  j = bcdToDec(Wire.read() & 0b111111); //24 hour time
  hk = bcdToDec(Wire.read()); //0-6 -> sunday - Saturday
  tg = bcdToDec(Wire.read());
  bl = bcdToDec(Wire.read());
  th = bcdToDec(Wire.read());
    delay (233);

if (d2!= d) {d2= d ; d3 = d3 + 1;
  if (d3 > 16 ) d3=0; }
int ji =i/100; int mi =(i%100) + wt ; if (mi>59){ji=ji+1; mi=mi-60; }
int js =s/100; int ms =(s %100) + wt;if (ms>59){js=js+1; ms=ms-60; } 
int jz =z/100; int mz =(z %100) +wt; if (mz>59){jz=jz+1; mz=mz-60; }
int ja =a/100; int ma =(a %100) + wt; if (ma>59){ja=ja+1; ma=ma-60; }
int jm =m/100; int mm =(m %100) + wt; if (mm>59){jm=jm+1; mm=mm-60; }
  waktuu = "Jam : " + String (j/10)+String (j%10)+":"+String (mn/10)+ String (mn %10)+":"+String (d/10)+String (d%10) ;
if (d3==3 )    waktu2 = "Isya : " + String(ji/10)+ String(ji%10) + ":" +String(mi/10)+ String(mi%10) ; 
if (d3==5 )    waktu2 = "Subuh : " + String(js/10)+ String(js%10) + ":"+String(ms/10)+ String(ms %10) ; 
if (d3==7 )    waktu2 = "Zuhur : " + String(jz/10)+ String(jz%10) + ":"+String(mz/10)+ String(mz %10) ; 
if (d3==9 )    waktu2 = "Asar : " + String(ja/10)+ String(ja%10) + ":"+String(ma/10)+ String(ma%10) ; 
if (d3==11 )    waktu2 = "Magrib : " + String(jm/10)+ String(jm%10) + ":"+String(mm/10)+ String(mm %10) ; 
if (d3==1 )    waktu2 = "Jadwal Shalat " ; 
if (d3==13 )    waktu2 = "1. Seting Alat"; 
if (d3==15 )    waktu2 = "Tgl : "+ String(tg)+"-"+ String (bl)+ "-20"+String(th); 
   lcd.clear() ;
  lcd.setCursor(0,0);
  lcd.print(waktuu);
  lcd.setCursor(0,1);
  lcd.print(waktu2); delay(222);
  
  if (digitalRead (ta) ==1 ) {  k=2; delay (200); }
 }

  if (hk==0) hari="Minggu" ;
  if (hk==1) hari="Senin" ;
  if (hk==2) hari="Selasa" ;
  if (hk==3) hari="Rabu" ;
  if (hk==4) hari="Kamis" ;
  if (hk==5) hari="Jum'at" ;
  if (hk==6) hari="Saptu" ;


if (k==2) {
if (tm==1){
  lcd.clear ();
  lcd.setCursor(0,0);
  lcd.print("Memasuki Menu ");
  lcd.setCursor(0,1);
  lcd.print("Pengaturan Alat ");
  delay (1100);
  tm=2;   }

if (tm==2){
  lcd.clear ();
  lcd.setCursor(0,0);
  lcd.print("1. Seting Kota ");
  lcd.setCursor(0,1);
  lcd.print("2. Seting Waktu");
if (digitalRead (tbb)==1) { delay (100); tm=3; }
if (digitalRead (ta)==1) {delay (100);   tm=11;}
delay (500);

}


if (tm==3){
  lcd.clear ();
  lcd.setCursor(0,0);
  lcd.print(" Merubah Waktu ");
  lcd.setCursor(0,1);
  lcd.print("1. Ya   2. Tidak ");
if (digitalRead (tbb)==1) { delay (100); k=1; tm=1; }
if (digitalRead (ta)==1) {delay (100);   tm=4;}
delay (500);

}

if (tm==4){
  lcd.clear ();
  lcd.setCursor(0,0);
  lcd.print("Jam : "); lcd.print (j);
  lcd.setCursor(0,1);
  lcd.print("1= +  2= -  3=OK");
if (digitalRead (ta)==1) { j=j+1; delay (100); }
if (digitalRead (tbb)==1) { j=j-1; delay (100); }
if (digitalRead (tc)==1) {tm=5; delay (100); }
 if (j>23) j=0;
 if (j<0) j=23;
  delay(300); ;
}

if (tm==5){
  lcd.clear ();
  lcd.setCursor(0,0);
  lcd.print("Menit : "); lcd.print (String (mn/10)+ String (mn %10));
  lcd.setCursor(0,1);
  lcd.print("1= +  2= -  3=OK"); 
if (digitalRead (ta)==1) { mn=mn+1; delay (100); }
if (digitalRead (tbb)==1) { mn=mn-1; delay (100); }
if (digitalRead (tc)==1) {tm=6; delay (100); }
 if (mn>59) mn=0;
 if (mn<0) mn=59;

delay(200); ;
}
if (tm==6){
  lcd.clear ();
  lcd.setCursor(0,0);
  lcd.print("Hari : "); lcd.print (hari);
  lcd.setCursor(0,1);
  lcd.print("1= +  2= -  3=OK"); 
if (digitalRead (ta)==1) { hk=hk+1; delay (100); }
if (digitalRead (tbb)==1) { hk=hk-1; delay (100); }
if (digitalRead (tc)==1) {tm=7; delay (100); }
 if (hk>6) hk=0;
 if (hk<0) hk=6;

delay(200); ;
}

if (tm==7){
  lcd.clear ();
  lcd.setCursor(0,0);
  lcd.print("Tanggal : "); lcd.print (tg);
  lcd.setCursor(0,1);
  lcd.print("1= +  2= -  3=OK"); 
if (digitalRead (ta)==1) { tg=tg+1; delay (100); }
if (digitalRead (tbb)==1) { tg=tg-1; delay (100); }
if (digitalRead (tc)==1) {tm=8; delay (100); }
 if (tg>31) tg=0;
 if (tg<0) tg=31;
delay(200); ;
}

if (tm==8){
  lcd.clear ();
  lcd.setCursor(0,0);
  lcd.print("Bulan : "); lcd.print (bl);
  lcd.setCursor(0,1);
  lcd.print("1= +  2= -  3=OK"); 
if (digitalRead (ta)==1) { bl=bl+1; delay (100); }
if (digitalRead (tbb)==1) { bl=bl-1; delay (100); }
if (digitalRead (tc)==1) {tm=9; delay (100); }
 if (bl>12) bl=1;
 if (bl<1) bl=12;
delay(200); ;
}
if (tm==9){
  lcd.clear ();
  lcd.setCursor(0,0);
  lcd.print("Tahun : "); lcd.print (th);
  lcd.setCursor(0,1);
  lcd.print("1= +  2= -  3=OK"); 
if (digitalRead (ta)==1) { th=th+1; delay (100); }
if (digitalRead (tbb)==1) { th=th-1; delay (100); }
if (digitalRead (tc)==1) {tm=10; delay (100); }
delay(200); ;
}

if (tm==10){
  lcd.clear ();
  lcd.setCursor(0,0);
  lcd.print("Data Disimpan"); 
  lcd.setCursor(0,1);
  lcd.print("1= Ya    2= Tidak"); 
if (digitalRead (ta)==1) { 
  Wire.beginTransmission(DS1307_ADDRESS);
  Wire.write(zero); //stop Oscillator

  Wire.write(decToBcd(d));
  Wire.write(decToBcd(mn));
  Wire.write(decToBcd(j));
  Wire.write(decToBcd(hk));
  Wire.write(decToBcd(tg));
  Wire.write(decToBcd(bl));
  Wire.write(decToBcd(th));
  Wire.write(zero); //start 
  Wire.endTransmission();

delay (100);
tm=1; k=1;
}
if (digitalRead (tbb)==1) { tm=1; k=1; }
delay(200); ;
}

if (tm==11){
  lcd.clear ();
  lcd.setCursor(0,0);
  lcd.print("Pilihlah Kota ");
  lcd.setCursor(0,1);
  lcd.print("Lokasi Anda");
  delay (1100);
  tm=12;   }

if (tm==12 ){
if (pil==1) { wt=12 ; kota="Kota Jakarta";}
if (pil==2) { wt=11 ; kota="Kota Bandung";}
if (pil==3) { wt=12 ; kota="Kota Karawang";}
if (pil==4) { wt=11 ; kota="Kota Purwakarta";}
if (digitalRead (ta)==1) { pil=pil+1; delay(155); }
if (digitalRead (tc)==1) { tm=1; k=1; }
if (pil>4) pil=1;
if (pil<1) pil=4;
  lcd.clear ();
  lcd.setCursor(0,0);
  lcd.print(kota);
  lcd.setCursor(0,1);
  lcd.print("1.Next  3.Ok");
  delay (200);
   }

}
// Mengecek jadwal Shalat 
// Data di update Setiap Hari 
if (tg2!= tg) {
  tg2 = tg;
  tb = (bl*100) + tg ;
  if (tb==101 ||tb==102 || tb==103 ||tb== 104 || tb==105 ) { i= 1916 ; s=409 ; z=1146; a=1510; m=1802; }
if (tb==106 || tb==107 || tb== 108 || tb== 109 || tb==110 ){i=1920; s=411 ; z= 1149; a= 1514; m= 1805; }
if (tb==111 || tb==112 || tb== 113 || tb== 114 || tb==115 ) {i=1921; s=414; z=1151; a=1515; m=1807; }
if (tb==116 || tb==117 || tb== 118 || tb== 119 || tb==120 ) {i=1921; s=417; z=1153; a=1516; m=1808;}
if (tb==121 || tb==122 || tb== 123 || tb== 124 || tb==125 ){ i=1922; s=420; z=1154; a=1516; m=1809;}
if (tb==126 || tb==127 || tb== 128 || tb== 129 || tb==130 ){ i=1922; s=422; z=1155; a=1515; m=1809;}
if (tb==131 || tb==201 || tb== 202 || tb== 203 ){ i=1922; s=424; z=1156; a=1514; m=1809;}
if (tb==204  || tb==205 || tb== 206 || tb== 207 ||tb== 207  ){i=1918; s=426 ; z=1156 ; a=1512; m=1808;}
if (tb==209 || tb==210 || tb== 211 || tb== 212 || tb==213) { i=1917;  s= 427; z= 1156; a= 1510; m= 1807 ;}
if (tb==214 || tb==215 || tb== 216 || tb== 217 || tb==218) { i=1915; s= 429; z=1156; a=1508; m=1806; }
if (tb==219 || tb==220 || tb== 221 || tb== 222 || tb==223) { i=1914; s= 431; z=1156; a=1504; m=1805;}
if (tb==224 || tb==225 || tb== 226 || tb== 227 || tb==228 || tb==29 ) {i=1913; s= 432; z=1155; a=1500; m=1803;}
if (tb==301 || tb==302 || tb== 303 || tb== 304 || tb==305) {i=1910; s= 432; z=1154; a=1457; m=1801;}
if (tb==306 || tb==307 || tb== 308 || tb== 309 || tb==310) {i=1908; s=432; z=1153; a=1459; m=1759;}
if (tb==311 || tb==311 || tb== 312 || tb== 313 || tb==311 || tb==315) {i=1905; s=433; z=1152; a=1501; m=1757;}
if (tb==316 || tb==317 || tb== 318 || tb== 319 || tb==320 ){i=1903; s=432; z=1150; a=1501; m=1754;}
if (tb==312 || tb==322 || tb== 323 || tb== 324 || tb==325 ){i=1900; s=432; z=1149; a=1502; m=1752;}
if (tb==326 || tb==311 || tb== 327 || tb== 328 || tb==329|| tb==330|| tb==331  ){i=1858; s=431; z=1147; a=1502; m=1749;}
if (tb==401 || tb==402 || tb== 403 || tb== 404 || tb==405 ){i=1855; s=430; z=1147; a=1503; m=1747;}
if (tb==406 || tb==407 || tb== 408 || tb== 409 || tb==410 ){i=1852; s=429; z=1144; a=1502; m=1744;}
if (tb==411 || tb==412 || tb== 413 || tb== 414 || tb==415 ){i=1851; s=429; z=1143; a=1501; m=1742;}
if (tb==416 || tb==416 || tb== 417 || tb== 418 || tb==419|| tb==420 ){ i=1849; s=428; z=1142; a=1501; m=1740;}
if (tb==421 || tb==422 || tb== 423 || tb== 424 || tb==425 ){i=1846; s=427; z=1140; a=1500; m=1737;}
if (tb==426 || tb==427 || tb== 428 || tb== 429 || tb==430 || tb==431 || tb==501 ){i=1845; s=426; z=1139; a=1459; m=1735;}
if (tb==502 || tb==503 || tb== 504 || tb== 505 || tb==506 ){i=1844; s=427; z=1139; a=1459; m=1734;}
if (tb==507 || tb==508 || tb== 509 || tb== 510 || tb==511 ){i=1843; s=426; z=1138; a=1458; m=1732;}
if (tb==512 || tb==513 || tb== 514 || tb== 515 || tb==516 ){i=1843; s=426; z=1138; a=1458; m=1731;}
if (tb==517 || tb==518 || tb== 519 || tb== 505 || tb==520 || tb==521 ){i=1844; s=427; z=1139; a=1459; m=1732;}
if (tb==522 || tb==523 || tb== 524 || tb== 525 || tb==526 ){i=1843; s=427; z=1139; a=1459; m=1731;}
if (tb==527 || tb==528 || tb== 529 || tb== 530 || tb==531 || tb==601 ){i=1844; s=428; z=1140; a=1500; m=1731;}
if (tb==602 || tb==603 || tb== 604 || tb== 605 || tb==606 ){i=1844;  s=429; z=1140; a=1500; m=1731;}
if (tb==607 || tb==608 || tb== 609 || tb== 610 || tb==611 ){i=1845; s=430; z=1141; a=1501; m=1731;}
if (tb==612 || tb==613 || tb== 614 || tb== 615 || tb==616 ){i=1846; s=431; z=1142; a=1502; m=1732;}
if (tb==617 || tb==618 || tb== 618 || tb== 620 || tb==621 ){i=1847; s=432; z=1143; a=1503; m=1733;}
if (tb==622 || tb==623 || tb== 624 || tb== 625 || tb==626 ){i=1848; s=433; z=1144; a=1504; m=1734;}
if (tb==627 || tb==628 || tb== 629 || tb== 630 || tb==631 || tb==701 || tb==702 ){i=1849; s=434; z=1145; a=1504; m=1735;}
if (tb==703 || tb==304 || tb== 705 || tb== 706 || tb==707 ) {i=1850; s=435; z=1146; a=1508; m=1736;}
if (tb==708 || tb==709 || tb== 710 || tb== 711 || tb==712) { i=1851; s=436; z=1147; a=1508; m=1738;}
if (tb==713 || tb==714 || tb== 715 || tb== 716 || tb==717) {i=1852; s=436; z=1148; a=1508; m=1739;}
if (tb==718 || tb==719 || tb== 720 || tb== 721 || tb==722) {i=1852; s=436; z=1148; a=1508; m=1740;}
if (tb==723 || tb==724 || tb== 725 || tb== 726 || tb==727){i=1853; s=436; z=1148; a=1508; m=1741;}
if (tb==728 || tb==729 || tb== 730 || tb== 731 || tb==801 || tb==802){i=1853; s=436; z=1148; a=1508; m=1741;}
if (tb==803 || tb==804 || tb== 805 || tb== 806 || tb==807 ){i=1853; s=436; z=1148; a=1508; m=1742;}
if (tb==808 || tb==809 || tb== 810 || tb== 811 || tb==812 || tb==802){i=1852; s=435; z=1147; a=1507; m=1742;}
if (tb==813 || tb==814 || tb== 814 || tb== 815 || tb==816 || tb==817){i=1852; s=433; z=1146; a=1503; m=1742;}
if (tb==818 || tb==819 || tb== 820 || tb== 821 || tb==822 || tb==823){i=1851; s=432; z=1145; a=1505; m=1742;}
if (tb==824 || tb==825 || tb== 826 || tb== 827 || tb==828 ){i=1851; s=430; z=1144; a=1503; m=1742;}
if (tb==829 || tb==830 || tb== 831 || tb== 901 || tb==902 ){i=1850; s=428; z=1142; a=1500; m=1741;}
if (tb==903 || tb==904 || tb== 905 || tb== 906 || tb==907 ){i=1849; s=426; z=1141; a=1457; m=1741;}
if (tb==908 || tb==909 || tb== 910 || tb== 911 || tb==912 ){i=1848; s=423; z=1139; a=1455; m=1740;}
if (tb==914 || tb==915 || tb== 916 || tb== 917 || tb==913 ){i=1848; s=421; z=1137; a=1452; m=1739;}
if (tb==918 || tb==919 || tb== 920 || tb== 921 || tb==922|| tb==923 ){i=1846; s=418; z=1135; a=1448; m=1738;}
if (tb==924 || tb==925 || tb== 926 || tb== 927 || tb==928|| tb==928){i=1846; s=415; z=1134; a=1444; m=1737;}
if (tb==929 || tb==930 || tb== 931 || tb== 1001 || tb==1003|| tb==1004){i=1846; s=413; z=1132; a=1441; m=1737;}
if (tb==1004 || tb==1005 || tb== 1006 || tb== 1007 || tb==1008){i=1845; s=409; z=1130; a=1436; m=1736;}
if (tb==1009 || tb== 1010 || tb== 1011 || tb==1012|| tb==1013 ){i=1845; s=407; z=1129; a=1432; m=1736;}
if (tb==1014 || tb==1015 || tb== 1016 || tb== 1017 || tb==1018){i=1846; s=405; z=1128; a=1433; m=1736;}
if (tb==1019 || tb==1020 || tb== 1021 || tb== 1022 || tb==1023){i=1845; s=402; z=1127; a=1435; m=1736;}
if (tb==1024 || tb==1025 || tb== 1026 || tb== 1027 || tb==1028 ){i=1845; s=359; z=1126; a=1438; m=1736;}
if (tb==1029 || tb==1030 || tb== 1031 || tb== 1101 || tb==1102 ){i=1847; s=357; z=1126; a=1440; m=1737;}
if (tb==1103 || tb==1104 || tb== 1105 || tb== 1106 || tb==1107 ) {i= 1848; s=356;  z=1126; a=1444; m=1738;}
if (tb==1108 || tb==1109 || tb== 1110 || tb== 1111 || tb==1112){i=1853; s=355; z=1127; a=1445; m=1740;}
if (tb==1113 || tb==1114 || tb== 1115 || tb== 1116 || tb==1117){i=1854; s=354; z=1127; a=1447; m=1741;}
if (tb==1118 || tb==1119 || tb== 1120 || tb== 1121 || tb==1122){i=1856; s=354; z=1128; a=1450; m=1743;}
if (tb==1123 || tb==1124 || tb== 1125 || tb== 1126 || tb==1127){i=1859; s=354; z=1130; a=1453; m=1745;}
if (tb==1128 || tb==1129 || tb== 1130 || tb== 1131 || tb==1201){i=1901; s=354; z=1131; a=1455; m=1747;}
if (tb==1202 || tb==1203 || tb== 1204 || tb== 1205 || tb==1206){i=1904; s=355; z=1133; a=1458; m=1749;}
if (tb==1207 || tb==1208 || tb== 1209 || tb== 1210 || tb==1211){i=1907; s=356; z=1135; a=1500; m=1751;}
if (tb==1212 || tb==1213 || tb== 1214 || tb== 1215 || tb==1216){i=1909; s=357; z=1137; a=1503; m=1754;}
if (tb==1217 || tb==1218 || tb== 1219 || tb== 1220 || tb==1221){i=1911; s=358; z=1139; a=1505; m=1756;}
if (tb==1222 || tb==1223 || tb== 1224 || tb== 1225 || tb==12206){i=1914; s=401; z=1142; a=1508; m=1759;}
if (tb==1227 || tb==1228 || tb== 1229 || tb== 1230 || tb==1231){i=1916; s=403; z=1144; a=1510; m=1801;}
} // akhir pengecekan data bes jadwal shalat

}

byte bcdToDec(byte val)  {
// Convert binary coded decimal to normal decimal numbers
  return ( (val/16*10) + (val%16) );
}

byte decToBcd(byte val){
// Convert normal decimal numbers to binary coded decimal
  return ( (val/10*16) + (val%10) );
}

----------------------------------------------------------------------------------------


Listing Program di atas dapat digunakan untuk wilayah Jakarta, Bandung, Karawang dan Purwakarta. ketika alat ini pertama kali dihidupkan maka tempat yang di tampilkan adalah jakarta, untuk merubahnya ke kota lain dapat di atur di pengaturan alat. kelemahan alat ini adalah jika alat di matikan setingan kota akan kembali ke kota jakarta. 
jika menginginkan alat yang setingan kotanya tidak berubah jika alat dimatikan maka listing program perlu di tambah dengan memanfaatkan EEPROM yang ada di mikrokontroller untuk menyimpan setingan data.