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

5 years ago
  1. /*
  2. * NOTE: this test is for HFS-DC06H
  3. *
  4. * ZMHW Changes:
  5. *
  6. * Using pin 4. This might change depending on PCB revision. Double
  7. * check.
  8. *
  9. * If the Digital Hi (reads as 1's in serial) doesn't go away, and you are using USB,
  10. * you might need external power. Some USB is not enough.
  11. * Especially when ethernet is active.
  12. * Ethernet draws power, even if library is not active.
  13. */
  14. /*
  15. DigitalReadSerial
  16. Reads a digital input on pin 2, prints the result to the serial monitor
  17. This example code is in the public domain.
  18. */
  19. // digital pin 2 has a pushbutton attached to it. Give it a name:
  20. int MotionSensor = 4;
  21. // the setup routine runs once when you press reset:
  22. void setup() {
  23. // initialize serial communication at 9600 bits per second:
  24. Serial.begin(9600);
  25. // make the pushbutton's pin an input:
  26. pinMode(MotionSensor, INPUT);
  27. }
  28. // the loop routine runs over and over again forever:
  29. void loop() {
  30. // read the input pin:
  31. int MotionState = digitalRead(MotionSensor);
  32. // print out the state of the button:
  33. Serial.println(MotionState);
  34. delay(100); // delay in between reads for stability
  35. }