fix control buttons order

This commit is contained in:
Filip Rojek 2021-06-06 18:29:25 +02:00
parent 6c79e4d8e4
commit 99b04ef3c2

View File

@ -16,12 +16,12 @@ int relay3 = 5;
int relay4 = 4; int relay4 = 4;
// codes from remote controller // codes from remote controller
const int recRelay4 = 16736114; const int recRelay4 = 3696136;
const int recRelay3 = 16736120; const int recRelay3 = 16736114;
const int recRelay2 = 3696136; const int recRelay2 = 16736120;
const int recRelay1 = 16736113; const int recRelay1 = 16736113;
int delayTime = 2000; int delayTime = 500;
void setup() void setup()
{ {
@ -37,12 +37,12 @@ void setup()
mySwitch.enableReceive(0); // Receiver on interrupt 0 => that is pin #2 mySwitch.enableReceive(0); // Receiver on interrupt 0 => that is pin #2
//clear out the registers //clear out the registers
rtc.initClock(); ///rtc.initClock();
//set a time to start with. //set a time to start with.
//day, weekday, month, century(1=1900, 0=2000), year(0-99) //day, weekday, month, century(1=1900, 0=2000), year(0-99)
rtc.setDate(14, 6, 3, 1, 10); ///rtc.setDate(6, 7, 6, 0, 21);
//hr, min, sec //hr, min, sec
rtc.setTime(1, 15, 0); ///rtc.setTime(14, 16, 0);
} }
void updateRTC() void updateRTC()
@ -89,6 +89,9 @@ void relayOn(int pin)
digitalWrite(pin, HIGH); digitalWrite(pin, HIGH);
delay(delayTime); delay(delayTime);
if(pin == relay3) {
// delay(1500);
}
digitalWrite(pin, LOW); digitalWrite(pin, LOW);
delay(delayTime); delay(delayTime);
@ -99,11 +102,19 @@ void relayOn(int pin)
void loop() void loop()
{ {
//formatted strings are at the current time/date. //formatted strings are at the current time/date.
Serial.print(rtc.formatTime()); //Serial.print(rtc.formatTime());
//Serial.print("\r\n");
//Serial.print(rtc.formatDate());
//Serial.print("\r\n");
//delay(1000);
//char j = rtc.formatTime(RTCC_TIME_HM)[0];
//char d = rtc.formatTime(RTCC_TIME_HM)[1];
Serial.print();
Serial.print();
Serial.print("\r\n"); Serial.print("\r\n");
Serial.print(rtc.formatDate());
Serial.print("\r\n");
delay(1000);
if (Serial.available()) if (Serial.available())
{ {
@ -116,6 +127,7 @@ void loop()
Serial.println("cegoslav"); Serial.println("cegoslav");
} }
// wind actions // wind actions
if (digitalRead(wind) == HIGH) if (digitalRead(wind) == HIGH)
{ {
@ -126,6 +138,7 @@ void loop()
digitalWrite(relay1, LOW); digitalWrite(relay1, LOW);
} }
// remote controller actions // remote controller actions
if (mySwitch.available()) if (mySwitch.available())
{ {