I always forget to turn off the light, no longer bother to turn the lights
Not a member? You should Sign up.
Already have an account? Log in.
To make the experience fit your profile, pick a username and tell us what interests you.
View all 9 components
Source code:
int rolePin = 2; // pin that connects the relay int magnetPin = 3; // pin that connects magnetic switches int wait = 10000; // time to turn off light (in milliseconds) boolean doorStatus = false; void setup() { pinMode(rolePin, OUTPUT); pinMode(magnetPin, INPUT_PULLUP); } void loop() { int magnetState = digitalRead(magnetPin); if (magnetState == HIGH) { digitalWrite(rolePin, HIGH); doorStatus = true; } else{ if (doorStatus == true) { delay(wait); digitalWrite(rolePin, LOW); doorStatus = false; } } delay(5); }
View all instructions
Create an account to leave a comment. Already have an account? Log In.
Pim Zwager
bobricius
Christoph Tack
Kevin Claytor
Become a member to follow this project and never miss any updates
Yes, delete it Cancel
You are about to report the project "Arduino controlled door trigger light bulb", please tell us the reason.
Your application has been submitted.
Are you sure you want to remove yourself as a member for this project?
Project owner will be notified upon removal.