My problem is, when I upload my code, I got error message "Device not reply. Receive time out error"
and this is my code :
/*
-- Test Wifi Switch and Timer --
This source code of graphical user interface
has been generated automatically by RemoteXY editor.
To compile this code using RemoteXY library 2.3.5 or later version
download by link http://remotexy.com/en/library/
To connect using RemoteXY mobile app by link http://remotexy.com/en/download/
- for ANDROID 4.3.1 or later version;
- for iOS 1.3.5 or later version;
This source code is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
Menggunakan 2 baud :
- 115200 untuk melihat koneksi Wifi
- 9600 untuk melihat timer
*/
//////////////////////////////////////////////
// RemoteXY include library //
//////////////////////////////////////////////
// RemoteXY select connection mode and include library
#define REMOTEXY_MODE__ESP8266_HARDSERIAL_POINT
#include <RemoteXY.h> //Library RemoteXY
#include <DS3231.h> //Library Time yg simple
// RemoteXY connection settings
#define REMOTEXY_SERIAL Serial
#define REMOTEXY_SERIAL_SPEED 115200
#define REMOTEXY_WIFI_SSID "Rumah_Patoman1"
#define REMOTEXY_WIFI_PASSWORD ""
#define REMOTEXY_SERVER_PORT 6377
// RemoteXY configurate
#pragma pack(push, 1)
uint8_t RemoteXY_CONF[] =
{ 255,2,0,0,0,84,0,8,13,2,
2,0,6,6,22,11,6,6,22,11,
2,26,31,31,79,70,70,0,79,78,
0,2,0,6,22,22,11,6,22,22,
11,2,26,31,31,79,70,70,0,79,
78,0,129,0,32,8,18,6,32,8,
18,6,17,80,105,110,50,47,84,105,
109,101,114,0,129,0,32,25,18,6,
32,25,18,6,17,80,105,110,32,56,
0 };
// this structure defines all the variables of your control interface
struct {
// input variable
uint8_t switch_1; // =1 if switch OFF and =0 if ON (ini diganti supaya sesuai dengan warna led yg menyala di Relay)
uint8_t switch_2; // =1 if switch OFF and =0 if ON
// other variable
uint8_t connect_flag; // =1 if wire connected, else =0
} RemoteXY;
#pragma pack(pop)
/////////////////////////////////////////////
// END RemoteXY include //
/////////////////////////////////////////////
#define PIN_SWITCH_1 2
#define PIN_SWITCH_2 8
#define Relay2 2
#define Relay8 8 // Penamaan untuk Timer harapannya ga binggung mana timer mana tombol wifi
//Coding untuk RTCnya
DS3231 rtc(SDA, SCL);
Time t;
/*
Perintah untuk On-Off berdasarkan Jam dan Menit dgn format waktu 24
Banyakan Perintah On-Off bisa di tambah selama memorynya cukup
*/
const int OnHour = 19;
const int OnMin = 23;
const int OffHour = 7;
const int OffMin = 59;
const int OnHour2 = 8;
const int OnMin2 = 00;
const int OffHour2 = 8;
const int OffMin2 = 01;
//Tambah Perintahnya jika masih kurang
void setup()
{
//Perintah void Setup RemoteXY
RemoteXY_Init ();
pinMode (PIN_SWITCH_1, OUTPUT);
pinMode (PIN_SWITCH_2, OUTPUT);
// Perintah void Setup RTC Simple
Serial.begin(9600);
rtc.begin();
pinMode(Relay2, OUTPUT);
pinMode(Relay8, OUTPUT); // Tambahkan Namanya jika dibutuhkan
}
void loop()
{
RemoteXY_Handler ();
digitalWrite(PIN_SWITCH_1, (RemoteXY.switch_1==0)?LOW:HIGH); //"==0" artinya hidup (Lampu Merah&Hijau Menyala) | "==1" artinya mati (Hanya Lampu Merah yg menyala)
digitalWrite(PIN_SWITCH_2, (RemoteXY.switch_2==0)?LOW:HIGH);
//kode void loop RTC Simple
t = rtc.getTime();
Serial.print(t.hour);
Serial.print(" hour(s), ");
Serial.print(t.min);
Serial.print(" minute(s)");
Serial.println(" ");
delay (1000);
//Kode Perintah On-Off Timer
if(t.hour == OnHour && t.min == OnMin){
digitalWrite(Relay2,LOW); //Tentukan Pin mana yg mau di kontrol
Serial.println("LIGHT ON");
}
else if(t.hour == OffHour && t.min == OffMin){
digitalWrite(Relay2,HIGH);
Serial.println("LIGHT OFF");
}
if(t.hour == OnHour2 && t.min == OnMin2){
digitalWrite(Relay8,LOW);
Serial.println("LIGHT ON");
}
else if(t.hour == OffHour2 && t.min == OffMin2){
digitalWrite(Relay8,HIGH);
Serial.println("LIGHT OFF");
}
}