Arduino + PIR Sensor

  • Sat 27 April 2013

  • So I was asked if I wanted to play with Arduino stuff again. While I've got quite a few fires in the iron, I couldn't say no.

    So here's the short and sweet of it.

    Parts List:

    • Arduino Uno R3
    • Breadboard
    • Parallax PIR Sensor (Rev B)

    Here's the sketch:

    const int signal = 12;
    const int led = 13;
    int pir = 0;
    
    void setup() {
    Serial.begin(9600);
    Serial.println("Warming up...");
    delay(20000);
    pinMode(led, OUTPUT);
    }
    
    
    void loop() {
    pir = digitalRead(signal);
    digitalWrite(led, pir);
    Serial.println(pir, DEC);
    delay(200);
    }
    

    That's the short and sweet of it. I found various pieces online (including Parallax's own documetnation that is inconsistent).

    More to follow, as this is most certainly a very small piece of a much larger project.

    Here is a video of what the code produces

    Comments !

    social