Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- byte pirPin = 2; // define the IO pins
- byte ledPin = 13;
- void setup(){
- pinMode (pirPin, INPUT); // set them as inputs/outputs
- pinMode (ledPin, OUTPUT);
- }
- void loop(){
- if (digitalRead (pirPin) == LOW){ // read the input pin
- digitalWrite (ledPin, HIGH); // and drive the LED on
- }
- else { // pirPin is high, so
- digitalWrite (ledPin, LOW); // drive the LED off
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement