Created
November 20, 2016 18:31
-
-
Save fusion44/cbf7ebd6a9cf5cf96247662ca232a333 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
Reed Sensor between PIN and GND | |
*/ | |
// Reed Sensor variables | |
#define PIN_INPUT_REED_SENSOR 2 | |
boolean reedActivated = false; | |
void setup() { | |
Serial.begin(9600); | |
pinMode(PIN_INPUT_REED_SENSOR, INPUT); | |
digitalWrite(PIN_INPUT_REED_SENSOR, HIGH); | |
} | |
void loop() { | |
boolean tempActivated = digitalRead(PIN_INPUT_REED_SENSOR); | |
if (tempActivated != reedActivated) { | |
reedActivated = tempActivated; | |
Serial.println(tempActivated); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment