Back to Parent

Product

This is a basic breadboard circuit configuration with a hall effect US5881 sensor that turns on an LED light. The code is programmed to turn on the LED when it senses a magnet nearby. The application of this in real life is, for example, a simulation of a magnetized key turning on the lights when the door is unlocked.

The code is programmed to keep the light on even when the magnet is removed. At first, my if else statement was turning it off when the magnet was removed. The fix was frustratingly simple! By deleting the else, the loop stopped after turnOnLED(); and the light remained in the on state. (See code below).

A three prong, one sided switch was added to be able to turn off the light.


Content Rating

Is this a good/useful/informative piece of content to include in the project? Have your say!

0