Check if sliding door is closed #2132
Replies: 3 comments
-
Posted at 2017-04-15 by Robin Sat 2017.04.15 Although my experience is with the Pico, my guess is that any GPIO pin will work. The software function you are after is digitalRead() http://www.espruino.com/Reference#l__global_digitalRead Use this tutorial to garner insight. Wire Loop Game One wire to ground. The other through a 10K to the GPIO pin. Or rely on the internal pull-up. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2017-04-16 by Tineler Hi Robin Thanks for you response! It works using pinMode(PIN, "input_pullup") and digitalRead :-) |
Beta Was this translation helpful? Give feedback.
-
Posted at 2017-04-18 by @gfwilliams Great! Glad you got it sorted! You can also use Only think to watch out for is that if the door is normally closed (and so the contacts are normally closed) then You could use |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2017-04-15 by Tineler
Hey guys!
I want to check if the sliding door of my terrarium is closed using the Puck.js (light green LED if it is closed, else light red LED). I found a cool tutorial, where I can see how to do this using a magnet.
But I think a better solution would be to attach 2 wires to the Puck.js and then put a metal plate on the side of the door. If the door is closed, the circuits is also closed and otherwise it's open.
I'm not very familiar with the Puck.js so far, so I have two questions for this idea:
Thanks for your help!
Beta Was this translation helpful? Give feedback.
All reactions