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