PS: This idiotic forum does limit size so I have to post my code in 2 postings
Code: Select all
#include <ESP32Time.h>
ESP32Time rtc;
#include <x10.h>
#include <x10constants.h>
#define zcPin 2//2
#define dataPin 19//13
#define repeatTimes 2
x10 myHouse;
int switch1Pin = 18;//23;
int switch2Pin = 5;//33;
int switch3Pin = 17;//25;
int led = 4;//27;
int led2 = 0;//14;
volatile int blinkToken = 0;
int var = 0;
int varMonths = 0;
int varHour = 0;
void patternHome1() {/*MAKE THINNER*/
Serial.println("patterhome1 started");
if ((varHour == 0) && (rtc.getMinute() == 31)) {
myHouse.write(HOUSE_A, UNIT_1, repeatTimes);
myHouse.write(HOUSE_A, ON, repeatTimes);
}
if ((varHour == 0) && (rtc.getMinute() == 32)) {
myHouse.write(HOUSE_A, UNIT_1, repeatTimes);
myHouse.write(HOUSE_A, OFF, repeatTimes);
}
if ((varHour == 0) && (rtc.getMinute() == 37)) {
myHouse.write(HOUSE_B, UNIT_3, repeatTimes);
myHouse.write(HOUSE_B, OFF, repeatTimes);
myHouse.write(HOUSE_B, UNIT_2, repeatTimes);
myHouse.write(HOUSE_B, OFF, repeatTimes);
}
if ((varHour == 0) && (rtc.getMinute() == 42)) {
myHouse.write(HOUSE_A, UNIT_1, repeatTimes);
myHouse.write(HOUSE_A, ON, repeatTimes);
myHouse.write(HOUSE_A, UNIT_2, repeatTimes);
myHouse.write(HOUSE_A, ON, repeatTimes);
}
if ((varHour == 0) && (rtc.getMinute() == 43)) {
myHouse.write(HOUSE_A, UNIT_2, repeatTimes);
myHouse.write(HOUSE_A, OFF, repeatTimes);
}
if ((varHour == 0) && (rtc.getMinute() == 44)) {
myHouse.write(HOUSE_B, UNIT_3, repeatTimes);
myHouse.write(HOUSE_B, ON, repeatTimes);
}
if ((varHour == 1) && (rtc.getMinute() == 14)) {
myHouse.write(HOUSE_B, UNIT_3, repeatTimes);
myHouse.write(HOUSE_B, OFF, repeatTimes);
myHouse.write(HOUSE_B, UNIT_2, repeatTimes);
myHouse.write(HOUSE_B, ON, repeatTimes);
}
if ((varHour == 1) && (rtc.getMinute() == 18)) {
myHouse.write(HOUSE_A, UNIT_1, repeatTimes);
myHouse.write(HOUSE_A, OFF, repeatTimes);
}
if ((varHour == 1) && (rtc.getMinute() == 40)) {
myHouse.write(HOUSE_A, UNIT_2, repeatTimes);
myHouse.write(HOUSE_A, ON, repeatTimes);
myHouse.write(HOUSE_B, UNIT_2, repeatTimes);
myHouse.write(HOUSE_B, OFF, repeatTimes);
}
if ((varHour == 2) && (rtc.getMinute() == 11)) {
myHouse.write(HOUSE_B, UNIT_3, repeatTimes);
myHouse.write(HOUSE_B, ON, repeatTimes);
}
if ((varHour == 2) && (rtc.getMinute() == 17)) {
myHouse.write(HOUSE_B, UNIT_3, repeatTimes);
myHouse.write(HOUSE_B, OFF, repeatTimes);
}
if ((varHour == 2) && (rtc.getMinute() == 32)) {
myHouse.write(HOUSE_A, UNIT_1, repeatTimes);
myHouse.write(HOUSE_A, ON, repeatTimes);
}
if ((varHour == 2) && (rtc.getMinute() == 33)) {
myHouse.write(HOUSE_A, UNIT_1, repeatTimes);
myHouse.write(HOUSE_A, OFF, repeatTimes);
}
if ((varHour == 4) && (rtc.getMinute() == 13)) {
myHouse.write(HOUSE_B, UNIT_3, repeatTimes);
myHouse.write(HOUSE_B, ON, repeatTimes);
}
if ((varHour == 4) && (rtc.getMinute() == 16)) {
myHouse.write(HOUSE_B, UNIT_3, repeatTimes);
myHouse.write(HOUSE_B, OFF, repeatTimes);
}
if ((varHour == 4) && (rtc.getMinute() == 26)) {
myHouse.write(HOUSE_A, UNIT_1, repeatTimes);
myHouse.write(HOUSE_A, ON, repeatTimes);
}
if ((varHour == 4) && (rtc.getMinute() == 28)) {
myHouse.write(HOUSE_A, UNIT_1, repeatTimes);
myHouse.write(HOUSE_A, OFF, repeatTimes);
myHouse.write(HOUSE_A, UNIT_2, repeatTimes);
myHouse.write(HOUSE_A, ON, repeatTimes);
}
if ((varHour == 6) && (rtc.getMinute() == 55)) {
myHouse.write(HOUSE_B, UNIT_3, repeatTimes);
myHouse.write(HOUSE_B, ON, repeatTimes);
myHouse.write(HOUSE_A, UNIT_2, repeatTimes);
myHouse.write(HOUSE_A, OFF, repeatTimes);
}
if ((varHour == 7) && (rtc.getMinute() == 12)) {
myHouse.write(HOUSE_A, UNIT_1, repeatTimes);
myHouse.write(HOUSE_A, ON, repeatTimes);
}
if ((varHour == 7) && (rtc.getMinute() == 37)) {
myHouse.write(HOUSE_A, UNIT_1, repeatTimes);
myHouse.write(HOUSE_A, OFF, repeatTimes);
myHouse.write(HOUSE_A, UNIT_2, repeatTimes);
myHouse.write(HOUSE_A, ON, repeatTimes);
}
if ((varHour == 7) && (rtc.getMinute() == 42)) {
myHouse.write(HOUSE_B, UNIT_3, repeatTimes);
myHouse.write(HOUSE_B, OFF, repeatTimes);
myHouse.write(HOUSE_A, UNIT_2, repeatTimes);
myHouse.write(HOUSE_A, OFF, repeatTimes);
}
if ((varHour == 8) && (rtc.getMinute() == 4)) {
}
if ((varHour == 20) && (rtc.getMinute() == 2)) {
myHouse.write(HOUSE_B, UNIT_3, repeatTimes);
myHouse.write(HOUSE_B, ON, repeatTimes);
}
if ((varHour == 20) && (rtc.getMinute() == 7)) {
myHouse.write(HOUSE_A, UNIT_1, repeatTimes);
myHouse.write(HOUSE_A, ON, repeatTimes);
myHouse.write(HOUSE_B, UNIT_2, repeatTimes);
myHouse.write(HOUSE_B, ON, repeatTimes);
myHouse.write(HOUSE_B, UNIT_3, repeatTimes);
myHouse.write(HOUSE_B, OFF, repeatTimes);
}
if ((varHour == 20) && (rtc.getMinute() == 23)) {
myHouse.write(HOUSE_A, UNIT_2, repeatTimes);
myHouse.write(HOUSE_A, ON, repeatTimes);
}
if ((varHour == 20) && (rtc.getMinute() == 51)) {
myHouse.write(HOUSE_A, UNIT_2, repeatTimes);
myHouse.write(HOUSE_A, OFF, repeatTimes);
myHouse.write(HOUSE_B, UNIT_3, repeatTimes);
myHouse.write(HOUSE_B, ON, repeatTimes);
myHouse.write(HOUSE_A, UNIT_1, repeatTimes);
myHouse.write(HOUSE_A, OFF, repeatTimes);
}
if ((varHour == 21) && (rtc.getMinute() == 13)) {
myHouse.write(HOUSE_B, UNIT_3, repeatTimes);
myHouse.write(HOUSE_B, OFF, repeatTimes);
myHouse.write(HOUSE_B, UNIT_2, repeatTimes);
myHouse.write(HOUSE_B, OFF, repeatTimes);
}
if ((varHour == 21) && (rtc.getMinute() == 34)) {
myHouse.write(HOUSE_B, UNIT_3, repeatTimes);
myHouse.write(HOUSE_B, ON, repeatTimes);
}
if ((varHour == 21) && (rtc.getMinute() == 48)) {
myHouse.write(HOUSE_A, UNIT_1, repeatTimes);
myHouse.write(HOUSE_A, ON, repeatTimes);
myHouse.write(HOUSE_A, UNIT_2, repeatTimes);
myHouse.write(HOUSE_A, ON, repeatTimes);
}
if ((varHour == 21) && (rtc.getMinute() == 51)) {
myHouse.write(HOUSE_A, UNIT_1, repeatTimes);
myHouse.write(HOUSE_A, OFF, repeatTimes);
}
if ((varHour == 23) && (rtc.getMinute() == 36)) {
myHouse.write(HOUSE_A, UNIT_2, repeatTimes);
myHouse.write(HOUSE_A, OFF, repeatTimes);
}
if ((varHour == 23) && (rtc.getMinute() == 51)) {
myHouse.write(HOUSE_B, UNIT_2, repeatTimes);
myHouse.write(HOUSE_B, ON, repeatTimes);
myHouse.write(HOUSE_B, UNIT_3, repeatTimes);
myHouse.write(HOUSE_B, OFF, repeatTimes);
}
if ((varHour == 23) && (rtc.getMinute() == 56)) {
myHouse.write(HOUSE_B, UNIT_3, repeatTimes);
myHouse.write(HOUSE_B, ON, repeatTimes);
}
}