Created
September 15, 2019 18:22
-
-
Save sfambach/71043b4ce8c03482e6bedfaecd14373f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** HC SR501 Test | |
* www.fambach.net | |
* GPL V2 | |
*/ | |
#define SR501PIN A0 | |
void setup() { | |
Serial.begin(115200); | |
// init pin | |
pinMode(A0, INPUT_PULLUP); | |
} | |
void loop() { | |
if (digitalRead(A0) == HIGH) { | |
Serial.print("PIR activated ..."); | |
while (digitalRead(A0) == HIGH) { | |
//Serial.print("."); | |
} | |
Serial.println(" now inactive"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment