Browse Source

disable PIR

main
Hendrik Langer 7 years ago
parent
commit
41b46fc952
  1. 10
      src/main.cpp

10
src/main.cpp

@ -90,7 +90,7 @@ void setup() {
// rtc_gpio_deinit((gpio_num_t)buttonPin); // rtc_gpio_deinit((gpio_num_t)buttonPin);
pinMode(buttonPin, INPUT_PULLUP); pinMode(buttonPin, INPUT_PULLUP);
// rtc_gpio_deinit((gpio_num_t)sensorPin); // rtc_gpio_deinit((gpio_num_t)sensorPin);
pinMode(sensorPin, INPUT); pinMode(sensorPin, INPUT_PULLUP);
pinMode(18, OUTPUT); pinMode(18, OUTPUT);
digitalWrite(18, HIGH); // disable LoRa_CS digitalWrite(18, HIGH); // disable LoRa_CS
@ -454,10 +454,10 @@ void loop()
Serial.print("Free Heap: "); Serial.print("Free Heap: ");
Serial.println(ESP.getFreeHeap()); Serial.println(ESP.getFreeHeap());
if (sensorON && digitalRead(sensorPin) == LOW) { /* if (sensorON && digitalRead(sensorPin) == LOW) {
uint16_t statusPacketIdSub = iot.mqtt.publish(sensorTopic.c_str(), 0, false, "OFF"); uint16_t statusPacketIdSub = iot.mqtt.publish(sensorTopic.c_str(), 0, false, "OFF");
sensorON = false; sensorON = false;
} } */
// Send a packet // Send a packet
udp.beginMulticastPacket(); udp.beginMulticastPacket();
@ -466,13 +466,13 @@ void loop()
} }
if (digitalRead(sensorPin) == HIGH) { /* if (digitalRead(sensorPin) == HIGH) {
lastActive = millis(); lastActive = millis();
if (sensorON == false && digitalRead(sensorPin) == HIGH) { if (sensorON == false && digitalRead(sensorPin) == HIGH) {
uint16_t statusPacketIdSub = iot.mqtt.publish(sensorTopic.c_str(), 0, false, timeStr); uint16_t statusPacketIdSub = iot.mqtt.publish(sensorTopic.c_str(), 0, false, timeStr);
sensorON = true; sensorON = true;
} }
} } */
if(millis() - lastTransmit >= 60*1000) { if(millis() - lastTransmit >= 60*1000) {
lastTransmit = millis(); lastTransmit = millis();

Loading…
Cancel
Save