From 69651c63fab0c78df0209d220822636376683fdc Mon Sep 17 00:00:00 2001 From: Your Name Date: Mon, 9 Mar 2020 01:19:38 -0400 Subject: [PATCH] ok --- Door_Chime/code/Door_Chime/Door_Chime.ino | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Door_Chime/code/Door_Chime/Door_Chime.ino b/Door_Chime/code/Door_Chime/Door_Chime.ino index 4dd731b..92e0a1b 100644 --- a/Door_Chime/code/Door_Chime/Door_Chime.ino +++ b/Door_Chime/code/Door_Chime/Door_Chime.ino @@ -4,6 +4,8 @@ #define SWLIGHT 10 #define SWREED 11 +#define LED 13 + //Switches on Pins 10, and 11 //Switch 10, is light switch. Ground when switch is up (ON). //Switch 11, is magnet reed switch, Ground when door is closed. @@ -15,6 +17,8 @@ void setup() { pinMode(FET, OUTPUT); pinMode(SWLIGHT, INPUT); pinMode(SWREED, INPUT); + + pinMode(LED, OUTPUT); } void loop() { @@ -40,6 +44,16 @@ void loop() { SWLIGHTvar = digitalRead(SWLIGHT); SWREEDvar = digitalRead(SWREED); + + //Use onboard LED to monitor whether magnet reed is synced or not + if(SWREEDvar == 1){ + digitalWrite(LED, 1); //magnet not connected to reed + } + else{ + digitalWrite(LED, 0); //magnet connected + } + + //trigger FET and Actuator if(SWLIGHTvar == 0){ if(SWREEDvar == 1){ digitalWrite(FET, 1); // turn on (HIGH is the voltage level)