PIR Notify LED (#702)

* Add PIR LED mirroring

* Lint formating

* Changed var name & added example define

Co-authored-by: Jonathan Michael Wells <jonathan-wells@oist.jp>
This commit is contained in:
JonandJonathan Michael Wells authored and GitHub committed 2020-07-19 06:34:13 -05:00
1 parent 40152d6a02
commit 40a69037e5
3 files changed
+19 -1

No files matched your search

+7
View File
@@ -33,6 +33,10 @@
void setupHCSR501() {
Log.notice(F("HCSR501 pin: %d" CR), HCSR501_GPIO);
pinMode(HCSR501_GPIO, INPUT); // declare HC SR-501 GPIO as input
# ifdef HCSR501_LED_NOTIFY_GPIO
pinMode(HCSR501_LED_NOTIFY_GPIO, OUTPUT);
digitalWrite(HCSR501_LED_NOTIFY_GPIO, LOW);
# endif
}
void MeasureHCSR501() {
@@ -58,6 +62,9 @@ void MeasureHCSR501() {
pirState = LOW;
}
}
# ifdef HCSR501_LED_NOTIFY_GPIO
digitalWrite(HCSR501_LED_NOTIFY_GPIO, pirState);
# endif
if (HCSR501data.size() > 0)
pub(subjectHCSR501toMQTT, HCSR501data);
}