DAFTAR PUSTAKA
[1]
Rahmiar. 2012. "Sistem Kontrol Aktifitas Lampu Rumah berbasis Komputer melalui Short Message Service". Jurusan Teknik Komputer Politeknik Negeri Palembang.
[2]
Rozidi, R.I. 2009. Membuat Sendiri SMS Gateway (ESME) Berbasis Protokol SMPP. Yogyakarta : Andi Offset.
[3]
Gupta. 2010. Aplikasi SMS Untuk Berbagai Keperluan Informatika. Bandung.
[4]
Utomo, P.A. 2008. Membangun Aplikasi SMS Berbasis Open Source. Yogyakarta : Andi Offset.
[5]
M.Hilmi Masruri. 2015. Membangun SMS Gateway dengan Gammu & Kalkun. Jakarta : PT Elex Media Komputindo.
[6]
Wahana Komputer. 2014. Mudah Membuat Aplikasi SMS Gateway dengan Codelgniter. Jakarta : PT Elex Media Komputindo.
[7]
Agung Nugroho. 2010. Mekatronika. Yogyakarta : Adi Graha Ilmu.
51
http://digilib.mercubuana.ac.id/
LAMPIRAN Pemograman arduino #include <SoftwareSerial.h> //menyertakan library emulasi serial #include <String.h> //menyertakan library string SoftwareSerial mySerial(2,3); //menetapkan emulasi serial ke pin 7 dan 8 //SoftwareSerial bluetooth(10,11); // RX, TX char vbyte; //variabel untuk mengambail karakter dari GSM String txtMsg; //variabel penampungan hasul baca dari GSM const int l293d1 = 6; const int l293d2 = 7; const int pwm_mot = 9;
void setup() { //Serail Port mySerial.begin(9600); //memulai layanan emulasi serial untuk modem Serial.println("Ready"); mySerial.println("AT+CNMI=1,2,0,0,0"); 52
http://digilib.mercubuana.ac.id/
delay(100);
mySerial.println("AT+CMGD=1,4"); pinMode(l293d1, OUTPUT); //output relay1 pinMode(l293d2, OUTPUT); //output relay2 pinMode(pwm_mot,OUTPUT); digitalWrite(l293d1, LOW); digitalWrite(l293d2, LOW);
mySerial.println("AT+CNMI=1,2,0,0,0"); delay(100); mySerial.println("AT+CMGD=1,4");
Serial.println("AT"); mySerial.println("AT"); while(mySerial.available()) Serial.write((byte)mySerial.read());
53
http://digilib.mercubuana.ac.id/
delay(500); Serial.println();
} void loop() { while(mySerial.available() > 0) { //jika ada data tersedia pada GSM vbyte = mySerial.read(); // bca satu byte pertama dan simpan pada variabel vbyte txtMsg.trim(); //menghilangkan karater yang ga diperlukan txtMsg.concat(vbyte); //menyambung kalimat Serial.print(vbyte); //menulis pada serial port txtMsg.trim(); //menghilangkan karakter yang ga diperlukan delay(10);
//
}
if (txtMsg.length() > 0 ) //jika terdapat karakter pada txtMsg {
54
http://digilib.mercubuana.ac.id/
if (txtMsg.charAt(0) == '+' and txtMsg.charAt(15) == ',') { txtMsg.setCharAt(0,' '); txtMsg.setCharAt(1,' '); txtMsg.setCharAt(2,' '); txtMsg.setCharAt(3,' '); txtMsg.setCharAt(4,' '); txtMsg.setCharAt(5,' '); txtMsg.setCharAt(6,' '); txtMsg.setCharAt(7,' '); txtMsg.setCharAt(8,' '); txtMsg.setCharAt(9,' '); txtMsg.setCharAt(10,' '); txtMsg.setCharAt(11,' '); txtMsg.setCharAt(12,' '); txtMsg.setCharAt(13,' '); txtMsg.setCharAt(14,' '); txtMsg.setCharAt(15,' ');
55
http://digilib.mercubuana.ac.id/
txtMsg.setCharAt(16,' '); txtMsg.setCharAt(17,' '); txtMsg.setCharAt(18,' '); txtMsg.setCharAt(19,' '); txtMsg.setCharAt(20,' '); txtMsg.setCharAt(21,' '); txtMsg.setCharAt(22,' '); txtMsg.setCharAt(23,' '); txtMsg.setCharAt(24,' '); txtMsg.setCharAt(25,' '); txtMsg.setCharAt(26,' '); txtMsg.setCharAt(27,' '); txtMsg.setCharAt(28,' '); txtMsg.setCharAt(29,' '); txtMsg.setCharAt(30,' '); txtMsg.setCharAt(31,' '); txtMsg.setCharAt(32,' ');
56
http://digilib.mercubuana.ac.id/
txtMsg.setCharAt(33,' '); txtMsg.setCharAt(34,' '); txtMsg.setCharAt(35,' '); txtMsg.setCharAt(36,' '); txtMsg.setCharAt(37,' '); txtMsg.setCharAt(38,' '); //txtMsg.setCharAt(39,' '); //txtMsg.setCharAt(40,' '); txtMsg.trim(); txtMsg.toUpperCase();
if (txtMsg == "FANONHIGH"){ digitalWrite(l293d1,0); digitalWrite(l293d2,1); analogWrite(pwm_mot,255); mySerial.print("AT+CMGF=1\r");
//Because we want to send the SMS in text
mode
57
http://digilib.mercubuana.ac.id/
delay(100); mySerial.println("AT + CMGS = \"+6281374362624\"");//send sms message, be careful need to add a country code before the cellphone number delay(100); mySerial.println("Kipas ON HIGH");//the content of the message delay(100); mySerial.println((char)26);//the ASCII code of the ctrl+z is 26 delay(100); mySerial.println(); } if (txtMsg == "FANON_LOW"){ digitalWrite(l293d1,0); digitalWrite(l293d2,1); analogWrite(pwm_mot,50); mySerial.print("AT+CMGF=1\r");
//Because we want to send the SMS in text
mode delay(100);
58
http://digilib.mercubuana.ac.id/
mySerial.println("AT + CMGS = \"+6281374362624\"");//send sms message, be careful need to add a country code before the cellphone number delay(100); mySerial.println("Kipas ON LOW");//the content of the message delay(100); mySerial.println((char)26);//the ASCII code of the ctrl+z is 26 delay(100); mySerial.println(); }
if (txtMsg == "FAN___OFF"){ digitalWrite(l293d1,0); digitalWrite(l293d2,1); analogWrite(pwm_mot,0); mySerial.print("AT+CMGF=1\r");
//Because we want to send the SMS in text
mode delay(100);
59
http://digilib.mercubuana.ac.id/
mySerial.println("AT + CMGS = \"+6281374362624\"");//send sms message, be careful need to add a country code before the cellphone number delay(100); mySerial.println("Kipas OFF");//the content of the message delay(100); mySerial.println((char)26);//the ASCII code of the ctrl+z is 26 delay(100); mySerial.println(); } //Serial.println("Nomor terdeteksi"); //Serial.println(txtMsg); } txtMsg.setCharAt(0,' '); txtMsg.trim(); //mySerial.end(); } }
60
http://digilib.mercubuana.ac.id/
61
http://digilib.mercubuana.ac.id/