membuat saklar lampu sms

MEMBUAT SAKLAR LAMPU SMS MENGUNAKAN ARDUINO DAN SIM800L

selamat datang gay,s maaf ngak semua gay,s dikira gay uppss!! kali ini saya akan memberikan  cara untuk membuat apa yaa?   kurang di mengerti maaf jika salah bahasa mohon di maafkan.
langsung saja kita memulai yaitu dengan judul diatas bisa dilihat ya penonton judulnya berada di atas 
kita akan memulai membuat sebuah alat untuk menghidupkan lampu mengunakan sms jaman sekarang tu orang pada malas apalagi yang baca ini sangat malas hehehe yaaa langsung saja dari tadi langsung saja ngk selesai selesai langsung sajanya. ok sekarang bahan-bahan yang digunakan antara lain yaitu 
1. Arduino uno 
2. Kabel jumper
3. Step down
4. Modul GSM SIM800L
5. kartu Sim card 
peralatan diatas bisa di beli di beberapa toko terdekat atau bisa di beli di bawah ini
https://za.gl/YNCIMe
berikut adalah rangkaian saklar lampu sms



Cara kerjanya adalah:
!. SIM800L kita setting program Auto Reading Incoming SMS
2. Kemudian Content SMS yang terbaca akan di INdex dan di cari kecocokan dengan settingan pada program yang kita buat
3. jika ada kecocokan Content SMS dan hasil Index maka akan memnuhi syarat fungsi if untuk menjalan kan program.


berikut adalah kode programnya:
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
#include <gprs.h>
#include <softwareserial.h>
 
#define TIMEOUT    5000
#define LED_PIN    13
#define ON 1
#define OFF 0

const int MERAH = 5;
const int BIRU = 6;
 
int StatusMerah;
int StatusBIRU;
GPRS gprs;
 
void setup() {
  pinMode (MERAH , OUTPUT);
  pinMode (BIRU , OUTPUT);
  Serial.begin(9600);
  while(!Serial);
 
  Serial.println("Starting SIM800 Auto Read SMS");
  gprs.preInit();
  delay(1000);
 
  while(0 != gprs.init()) {
      delay(1000);
      Serial.print("init error\r\n");
  } 
 
  //Set SMS mode to ASCII
  if(0 != gprs.sendCmdAndWaitForResp("AT+CMGF=1\r\n", "OK", TIMEOUT)) {
    ERROR("ERROR:CNMI");
    return;
  }
   
  //Start listening to New SMS Message Indications
  if(0 != gprs.sendCmdAndWaitForResp("AT+CNMI=1,2,0,0,0\r\n", "OK", TIMEOUT)) {
    ERROR("ERROR:CNMI");
    return;
  }
 
  Serial.println("Init success");
}
 
//Variable to hold last line of serial output from SIM800
char currentLine[500] = "";
int currentLineIndex = 0;
 
//Boolean to be set to true if message notificaion was found and next
//line of serial output is the actual SMS message content
bool nextLineIsMessage = false;
 
void loop() {
  //Write current status to LED pin
  digitalWrite(MERAH, StatusMerah);
  digitalWrite(BIRU, StatusBIRU);
   
  //If there is serial output from SIM800
  if(gprs.serialSIM800.available()){
    char lastCharRead = gprs.serialSIM800.read();
    //Read each character from serial output until \r or \n is reached (which denotes end of line)
    if(lastCharRead == '\r' || lastCharRead == '\n'){
        String lastLine = String(currentLine);
         
        //If last line read +CMT, New SMS Message Indications was received.
        //Hence, next line is the message content.
        if(lastLine.startsWith("+CMT:")){
           
          Serial.println(lastLine);
          nextLineIsMessage = true;
           
        } else if (lastLine.length() > 0) {
           
          if(nextLineIsMessage) {
            Serial.println(lastLine);
             

// ########## MEMBACA KONTEN SMS DAN MENCARI+MENGARTIKAN KONTEN SMS KE PROGRAM #########
            //Kendali LED MERAH
            if(lastLine.indexOf("MERAH ON") >= 0){
              StatusMerah = 1;
              Serial.println("LED MERAH DINYALAKAN");} 
              else if(lastLine.indexOf("MERAH OFF") >= 0) {
              StatusMerah = 0;
              Serial.println("LED MERAH DIMATIKAN");}
            //Kendali LED BIRU
            if(lastLine.indexOf("BIRU ON") >= 0){
              StatusBIRU = 1;
              Serial.println("LED BIRU DINYALAKAN");} 
              else if(lastLine.indexOf("BIRU OFF") >= 0) {
              StatusBIRU = 0;
              Serial.println("LED BIRU DIMATIKAN");}
             
            nextLineIsMessage = false;
          }
           
        }
         
        //Clear char array for next line of read
        for( int i = 0; i < sizeof(currentLine);  ++i ) {
         currentLine[i] = (char)0;
        }
        currentLineIndex = 0;
    } else {
      currentLine[currentLineIndex++] = lastCharRead;
    }
  }
}



Uplood program diatas  dan buka serial monitor kalian lalu coba kirimkan sms dengan karakter “MERAH ON” (tanpa tanda petik) maka led merah akan menyala dan saat mengirimkan karakter “MERAH OFF” maka led akan mati, cukup sekian tutorial kali ini semoga bermanfaat. Terima Kasih