Developing an LED night lamp

So now we have developed our mood lamp, but it will turn on only when we connect a power supply to Arduino. It won't turn on or off depending on the darkness of the environment. Also, to turn it off, we have to disconnect our power supply from Arduino. In this section, we will learn how to use switches with Arduino.

Introduction to switch

Switches are one of the most elementary and easy-to-overlook components. Switches do only one thing: either they open a circuit or short circuit. Mainly, there are two types of switches:

  • Momentary switches: Momentary switches are those switches which require continuous actuation—like a keyboard switch and reset button on the Arduino board
  • Maintained switches: Maintained switches are those ...

Get Arduino: Building exciting LED based projects and espionage devices now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.