Commit 1b0b91bb authored by Ondřej Kučera's avatar Ondřej Kučera
Browse files

improve bluetooth and serial output

parent abfd51b4
......@@ -86,6 +86,8 @@ void leavingTimeout() {
leaving = false;
authorized = false;
leavingDelay = leavingDelayConst;
Serial.println("Authorized person has left");
bluetooth.println("Authorized person has left");
} else {
leavingDelay -= millis() - accmillis;
}
......@@ -168,13 +170,13 @@ void checkIntruder() {
if (distance < 60 & intruder == false) {
intruder = true;
lastIntruderTime = accmillis;
Serial.println("someone is inside");
bluetooth.println("someone is inside");
//Serial.println("someone is inside");
//bluetooth.println("someone is inside");
} else if (distance > 60 & intruder == true & (accmillis - lastIntruderTime) > 4000) {
intruder = false;
lastIntruderTime = accmillis;
Serial.println("intruder left");
bluetooth.println("intruder left");
//Serial.println("intruder left");
//bluetooth.println("intruder left");
}
}
......@@ -193,15 +195,15 @@ void takeAction() {
//start an entering timeout to let an authorized person get in
if (authorized & !entered & !entering & !leaving) {
entering = true;
Serial.println("entering started");
bluetooth.println("entering started");
Serial.println("Authorized person has entered");
bluetooth.println("Authorized person has entered");
}
//start a leaving timeout to let an authorized person leave
if (authorized & !intruder & entered & !entering & !leaving) {
leaving = true;
Serial.println("leaving started");
bluetooth.println("leaving started");
Serial.println("Authorized person is leaving");
bluetooth.println("Authorized person is leaving");
}
}
......@@ -210,25 +212,25 @@ void SetAlarm(bool stat) {
if (stat) {
digitalWrite(alarm, HIGH);
alarmStat = true;
Serial.println("alarm started");
bluetooth.println("alarm started");
Serial.println("Alarm started");
bluetooth.println("Alarm started");
} else {
alarmStat = false;
digitalWrite(alarm, LOW);
Serial.println("alarm stopped");
bluetooth.println("alarm stopped");
Serial.println("Alarm stopped");
bluetooth.println("Alarm stopped");
}
}
void SetAuto(bool stat) {
if (stat) {
autoAlarm = true;
Serial.println("automatic alarm enabled");
bluetooth.println("automatic alarm enabled");
Serial.println("Automatic alarm enabled");
bluetooth.println("Automatic alarm enabled");
} else {
autoAlarm = false;
Serial.println("automatic alarm disabled");
bluetooth.println("automatic alarm disabled");
Serial.println("Automatic alarm disabled");
bluetooth.println("Automatic alarm disabled");
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment