Using a Sick WS15-D1130 Infrared Diode pair to act as a hardware motion detection sensor for Zoneminder. Also testing out an Omrom photo electric sensor, the E3F2-R2C4. This is a tripwire alarm sensor. When the beam is blocked, the alarm is activated.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

43 lines
1.1 KiB

/*
* NOTE: this test is for HFS-DC06H
*
* ZMHW Changes:
*
* Using pin 4. This might change depending on PCB revision. Double
* check.
*
* If the Digital Hi (reads as 1's in serial) doesn't go away, and you are using USB,
* you might need external power. Some USB is not enough.
* Especially when ethernet is active.
* Ethernet draws power, even if library is not active.
*/
/*
DigitalReadSerial
Reads a digital input on pin 2, prints the result to the serial monitor
This example code is in the public domain.
*/
// digital pin 2 has a pushbutton attached to it. Give it a name:
int MotionSensor = 4;
// the setup routine runs once when you press reset:
void setup() {
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
// make the pushbutton's pin an input:
pinMode(MotionSensor, INPUT);
}
// the loop routine runs over and over again forever:
void loop() {
// read the input pin:
int MotionState = digitalRead(MotionSensor);
// print out the state of the button:
Serial.println(MotionState);
delay(100); // delay in between reads for stability
}