在代码中,我们必须先定义Reed开关和LED连接到Arduino的引脚。干簧管连接到Arduino的数字引脚4,LED通过限流电阻连接到Arduino的数字引脚7。变量“reed_status”用于保存干簧的状态。 int LED = 7; int reed_switch = 4; int reed_status; 复制代码 在setup()函数中,我们需要设置LED和干簧管连接的引脚状态。引脚4...
Serial.println("Switch opened"); digitalWrite(LED_PIN, LOW);// Turn the LED off} } 上传草图后,抓住磁铁,把它靠近开关。当磁铁到达干簧管1厘米的距离时,它应该触发。 代码说明 该代码比较通俗易懂。首先定义了两个常量,它们声明了干簧管和内置LED连接到的Arduino引脚。 登录后复制constintREED_PIN =2;co...
Posted in Arduino Hacks, home hacksTagged arduino, cat poop, dog, dog poop, magnets, poop, reed switch Crank-Powered Train Uses No Batteries Or Plugs April 12, 2024 by Kristina Panos 5 Comments The prolific [Peter Waldraff] is at back it with another gorgeous micro train layout. This ...
In general reading a reed-switch should also be able to trigger the wakeup. Depending on the number of times it wakes the processor, just counting the events and transmitting a few times a day might be required to achieve good runtime. This certainly requires several changes, but is certainl...
Arduino and Raspberry Pi Sensor Projects for the Evil Genius by Robert Chin. McGraw Hill, 2017. Several of the projects in this book involve hooking up reed switches to Arduinos and Pis (there are complete instructions for a reed-switch door buzzer alarm). MAKE: Electronics by Charles Platt...
- Arduino Nano - Magnets and - Few Connecting Cables Demo --- Using a multi-meter I am going to show you how a Reed Switch works. When I bring a magnet close to the switch the multi-meter shows a continuity as the contact touches each other to completing the circuit. When the magnet...
Reed switches normally come in very small form factors so if you need something small then this may not be for you however the video does show you on a macro scale the fundamental workings of a reed switch. To make your own reed switch you need only a few parts: some copper, enamelled...
STEP 1: Reed Switch A reed switch is an electrical switch that is operated by a magnetic field. It is made up of two ferromagnetic, elongated, and flattened contact blades that measure 1 mm and are hermetically sealed inside a glass tube. ...
To see the code nano grove_relay.py # "Ctrl+x" to exit # import time import grovepi # Connect the Grove Relay to digital port D4 # SIG,NC,VCC,GND relay = 4 grovepi.pinMode(relay,"OUTPUT") while True: try: # switch on for 5 seconds ...