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.

32 lines
820 B

4 years ago
4 years ago
  1. /*
  2. * NOTE: this test is for HFS-DC06H
  3. *
  4. *
  5. * If the Digital Hi (reads as 1's in serial) doesn't go away, and you are using USB,
  6. * you might need external power. Some USB is not enough.
  7. * Especially when ethernet is active.
  8. * Ethernet draws power, even if library is not active.
  9. */
  10. int MotionSensor = 8;
  11. // the setup routine runs once when you press reset:
  12. void setup() {
  13. // initialize serial communication at 9600 bits per second:
  14. Serial.begin(9600);
  15. // make the pushbutton's pin an input:
  16. pinMode(MotionSensor, INPUT);
  17. }
  18. // the loop routine runs over and over again forever:
  19. void loop() {
  20. // read the input pin:
  21. int MotionState = digitalRead(MotionSensor);
  22. // print out the state of the button:
  23. Serial.println(MotionState);
  24. delay(300); // delay in between reads for stability
  25. }