ordnerstruktur verändert
This commit is contained in:
parent
29fdc20ea2
commit
4441a65bfc
3
arduino/Abmessungen bb104.txt
Normal file
3
arduino/Abmessungen bb104.txt
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
Höhe 3,0m
|
||||||
|
Breite 5,9m
|
||||||
|
Länge 8,9m
|
@ -84,28 +84,28 @@ void loop() {
|
|||||||
snprintf (msg, 50, "%c%c", 49, 48); //Codierung PIR1 steigende Flanke: 10
|
snprintf (msg, 50, "%c%c", 49, 48); //Codierung PIR1 steigende Flanke: 10
|
||||||
Serial.print("Publish Motion: ");
|
Serial.print("Publish Motion: ");
|
||||||
Serial.println(msg);
|
Serial.println(msg);
|
||||||
client.publish("/home/data", msg);
|
client.publish("/gso/bb/104/Pir/1", msg);
|
||||||
}
|
}
|
||||||
if (pirAn2) {
|
if (pirAn2) {
|
||||||
Serial.println("Steigende Flanke von PIR2");
|
Serial.println("Steigende Flanke von PIR2");
|
||||||
snprintf (msg, 50, "%c%c", 49, 49); //Codierung PIR2 steigende Flanke: 11
|
snprintf (msg, 50, "%c%c", 49, 49); //Codierung PIR2 steigende Flanke: 11
|
||||||
Serial.print("Publish Motion: ");
|
Serial.print("Publish Motion: ");
|
||||||
Serial.println(msg);
|
Serial.println(msg);
|
||||||
client.publish("/home/data", msg);
|
client.publish("/gso/bb/104/Pir/2", msg);
|
||||||
}
|
}
|
||||||
if (pirAus1) {
|
if (pirAus1) {
|
||||||
Serial.println("Fallende Flanke von PIR1");
|
Serial.println("Fallende Flanke von PIR1");
|
||||||
snprintf (msg, 50, "%c%c", 48, 48); //Codierung PIR1 fallende Flanke: 00
|
snprintf (msg, 50, "%c%c", 48, 48); //Codierung PIR1 fallende Flanke: 00
|
||||||
Serial.print("Publish Motion: ");
|
Serial.print("Publish Motion: ");
|
||||||
Serial.println(msg);
|
Serial.println(msg);
|
||||||
client.publish("/home/data", msg);
|
client.publish("/gso/bb/104/Pir/1", msg);
|
||||||
}
|
}
|
||||||
if (pirAus2) {
|
if (pirAus2) {
|
||||||
Serial.println("Fallende Flanke von PIR2");
|
Serial.println("Fallende Flanke von PIR2");
|
||||||
snprintf (msg, 50, "%c%c", 48, 49); //Codierung PIR2 fallende Flanke: 01
|
snprintf (msg, 50, "%c%c", 48, 49); //Codierung PIR2 fallende Flanke: 01
|
||||||
Serial.print("Publish Motion: ");
|
Serial.print("Publish Motion: ");
|
||||||
Serial.println(msg);
|
Serial.println(msg);
|
||||||
client.publish("/home/data", msg);
|
client.publish("/gso/bb/104/Pir/2", msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
pirValueAlt1 = pirValueNeu1;
|
pirValueAlt1 = pirValueNeu1;
|
@ -2,11 +2,11 @@
|
|||||||
#include <PubSubClient.h>
|
#include <PubSubClient.h>
|
||||||
|
|
||||||
//Eigene zu trackende Entfernung festlegen
|
//Eigene zu trackende Entfernung festlegen
|
||||||
#define DISTANCE 15
|
#define DISTANCE 155
|
||||||
|
|
||||||
const char* SSID = "smartroom";
|
const char* SSID = "smartroom";
|
||||||
const char* PSK = "smarthome";
|
const char* PSK = "smarthome";
|
||||||
const char* MQTT_BROKER = "192.168.4.1";
|
const char* MQTT_BROKER = "192.168.252.1";
|
||||||
WiFiClient espClient;
|
WiFiClient espClient;
|
||||||
PubSubClient client(espClient);
|
PubSubClient client(espClient);
|
||||||
|
|
||||||
@ -96,25 +96,33 @@ void loop() {
|
|||||||
if (((DISTANCE + 2) < distance) || ((DISTANCE - 2) > distance)) { //darf +- 2 um festgelegte entfernung schwanken, um störungen herauszufiltern
|
if (((DISTANCE + 2) < distance) || ((DISTANCE - 2) > distance)) { //darf +- 2 um festgelegte entfernung schwanken, um störungen herauszufiltern
|
||||||
//Meldung an PI, dass die Distanz gestört ist
|
//Meldung an PI, dass die Distanz gestört ist
|
||||||
snprintf (msg, 50, "%d", 1);
|
snprintf (msg, 50, "%d", 1);
|
||||||
client.publish("/home/data", msg);
|
client.publish("/gso/bb/104/ultraschall/1", msg);
|
||||||
//Serieller Monitor
|
//Serieller Monitor
|
||||||
Serial.print("Motion detected! Distance: ");
|
Serial.print("Motion detected! Distance: ");
|
||||||
Serial.println(msg);
|
Serial.println(distance);
|
||||||
|
|
||||||
//Flag auf 1
|
//Flag auf 1
|
||||||
bool1 = 1;
|
bool1 = 1;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
snprintf (msg, 50, "%d", 0);
|
||||||
|
client.publish("/gso/bb/104/ultraschall/1", msg);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (bool1 == 1) {
|
else if (bool1 == 1) {
|
||||||
if (((DISTANCE + 2) < distance) || ((DISTANCE - 2) > distance)) { //darf +- 2 um festgelegte entfernung schwanken, um störungen herauszufiltern
|
if (((DISTANCE + 2) < distance) || ((DISTANCE - 2) > distance)) { //darf +- 2 um festgelegte entfernung schwanken, um störungen herauszufiltern
|
||||||
Serial.print("Still motion detected! Distance: ");
|
Serial.print("Still motion detected! Distance: ");
|
||||||
Serial.println(distance);
|
Serial.println(distance);
|
||||||
|
//Meldung an PI, dass die Ausgangsdistanz wieder gemessen wird
|
||||||
|
snprintf (msg, 50, "%d", 1);
|
||||||
|
client.publish("/gso/bb/104/ultraschall/1", msg);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//Meldung an PI, dass die Ausgangsdistanz wieder gemessen wird
|
//Meldung an PI, dass die Ausgangsdistanz wieder gemessen wird
|
||||||
snprintf (msg, 50, "%d", 0);
|
snprintf (msg, 50, "%d", 0);
|
||||||
client.publish("/home/data", msg);
|
client.publish("/gso/bb/104/ultraschall/1", msg);
|
||||||
|
|
||||||
//Flag wieder auf 0
|
//Flag wieder auf 0
|
||||||
bool1 = 0;
|
bool1 = 0;
|
Loading…
x
Reference in New Issue
Block a user