PIR sensor code?
-
Customer question: Could you put Arduino code for PIR sensor?
-
Hi @robolink_hansol yes the code to program a passive infrared sensor can be seen below. If you come up with any cool projects please feel free to share
#include <SmartInventor.h> int PIR_Pin = 27; bool bodyPresent = 0; void setup() { Serial.begin(9600); pinMode(PIR_Pin, INPUT); } void loop() { bodyPresent = digitalRead(PIR_Pin); if(bodyPresent) { Serial.println("Body Detected"); SmartInventor.Buzz(200, 8); } else { Serial.println("No movement detected"); } }