/************************************************************************************************** * * PIR Motion Sensor SE-90 * * Version: 1.0.0 - January 2009 * Author: Etienne Ribeiro / tutorial assistant caad / eribeiro[at]ethz.ch * Supervisor: Christoph Wartmann / chair for caad - ETH Zürich / wartmann[at].arch.ethz.ch * * Desc: Shows the use of an analog Accelerator. This Module can be used to plug severel * Motion-Sensors to your project. Connect your sensors to any digital pin on your * board. * ***************************************************************************************************/ // // Const int digitalPin1 = 24; // Pin where PIR-Sensor's out pin is connected int digitalPin2 = 32; // // Var boolean initialized = false; // // Setup void setup() { // LED (2 * blink) pinMode(48, OUTPUT); digitalWrite(48, HIGH); delay(200); digitalWrite(48, LOW); delay(200); digitalWrite(48, HIGH); // Start Serial Serial.begin(9600); // Append Motion Sensor // You can append more Sensors if you want! MotionDetect_AppendSensor (digitalPin1); MotionDetect_AppendSensor (digitalPin2); } // // Loop void loop() { // if nothing moved during 3000 millis, sensor torns off and waits for next movement switch (MotionDetect_isSensorFiring (digitalPin1, 3000)) { case 1: Serial.println("Sensor1: Something moved..."); break; case 0: Serial.println("Sensor1: ...and stopped."); break; case -1: break; } switch (MotionDetect_isSensorFiring (digitalPin2, 3000)) { case 1: Serial.println("Sensor2: Something moved..."); break; case 0: Serial.println("Sensor2: ...and stopped."); break; case -1: break; } delay (200); }