Created
January 4, 2019 20:03
-
-
Save shockwaves/f507e7422df1b5e0aa7e40ba81b447ae to your computer and use it in GitHub Desktop.
arduino-door-alarm
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
#define pinDoor 2 | |
#define pinAlarm 3 | |
int doorStatus; | |
void setup() { | |
Serial.begin(9600); | |
pinMode(LED_BUILTIN, OUTPUT); | |
pinMode(pinAlarm, OUTPUT); | |
pinMode(pinDoor, INPUT_PULLUP); | |
} | |
void loop() { | |
doorStatus = digitalRead(pinDoor); | |
digitalWrite(LED_BUILTIN, doorStatus); | |
digitalWrite(pinAlarm, !doorStatus); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment