Tag Archives: Toggle Switch

Measure Temperature and Humidity on the Raspberry Pi Pico W

In this video lesson we show how to create a simple project where the Raspberry Pi Pico W is connected to a DHT11 temperature and humidity sensor. The Pico measures the temperature and humidity from the sensor, and then displays it both on the Computer Screen, and on the LCD display we have connected to the Pico.  The display toggles between showing degrees C and degrees F via a pushbutton. The schematic for the circuit is shown below:

Raspberry Pi Pico with DHT11
Schematic showing how to connect LCD, pushbutton and DHT11 to the Raspberry Pi Pico W

Below is the software we developed for this project. Note you must first install the LCD library, which we show how to do HERE.

 

Arduino Tutorial 28: Using a Pushbutton as a Toggle Switch

In lesson 27 we learned how to incorporate a pushbutton into an arduino project. We learned how to utilize pull-up and pull-down resistors in order to incorporate a button into a circuit. The operation of the button in lesson 27 was pretty simple . . . if the button was held down, the LED would come on. When the button was released, the LED would turn back off. This is an interesting demonstration, but much more interesting is the case where we make a toggle switch. If you press and release the button, the LED comes on, and then if you press and release the button again, the LED goes off. While this sounds very similar to the previous case, it turns out to require a lot more thought. This video lesson explains how to think about this problem, and how to make it work.

If you want to follow along at home, you can order the Arduino Kit we are using HERE.

Below is the code we used to achieve the toggle operation. The video gives details on how to connect up the circuit.