|
|
- /*
- * 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
- }
-
-
-
|