Add ability to inverse notify PIR LED (#765)

This commit is contained in:
Jon authored and GitHub committed 2020-09-22 13:04:29 -05:00
1 parent 55436c29fa
commit 1780458683
3 files changed
+8 -1

No files matched your search

+3
View File
@@ -53,3 +53,6 @@ You can have another PIN mirror the value of the PIR sensor output by adding the
This can be useful if you would like to connect an LED to turn on when motion is detected.
`#define HCSR501_LED_NOTIFY_GPIO 4`
This notification pin can be inverted if driving directly or through a transistor/mosfet.
`#define INVERT_LED_NOTIFY true`
+1 -1
View File
@@ -63,7 +63,7 @@ void MeasureHCSR501() {
}
}
# ifdef HCSR501_LED_NOTIFY_GPIO
digitalWrite(HCSR501_LED_NOTIFY_GPIO, pirState);
digitalWrite(HCSR501_LED_NOTIFY_GPIO, pirState == HCSR501_LED_ON);
# endif
if (HCSR501data.size() > 0)
pub(subjectHCSR501toMQTT, HCSR501data);
+4
View File
@@ -33,6 +33,10 @@ extern void HCSR501toMQTT();
#define subjectHCSR501toMQTT "/HCSR501toMQTT"
//#define HCSR501_LED_NOTIFY_GPIO 4 //Uncomment this line to mirror the state of the PIR sensor to the specified GPIO
#if defined(HCSR501_LED_NOTIFY_GPIO) && !defined(HCSR501_LED_ON)
# define HCSR501_LED_ON HIGH
#endif
#ifndef TimeBeforeStartHCSR501
# define TimeBeforeStartHCSR501 60000 //define the time necessary for HC SR501 init
#endif