Advertisement
ossipee

arduino pir example Crossroads

Jun 9th, 2014
381
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.43 KB | None | 0 0
  1. byte pirPin = 2;  // define the IO pins
  2. byte ledPin = 13;
  3. void setup(){
  4.   pinMode (pirPin, INPUT); // set them as inputs/outputs
  5.   pinMode (ledPin, OUTPUT);
  6. }
  7. void loop(){
  8.   if (digitalRead (pirPin) == LOW){  // read the input pin
  9.     digitalWrite (ledPin, HIGH);       // and drive the LED on
  10.   }
  11.   else {                                     // pirPin is high, so
  12.     digitalWrite (ledPin, LOW);      // drive the LED off
  13.   }
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement