From the course: Learning CircuitPython with Circuit Playground Express

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Using buttons and the switch

Using buttons and the switch - Python Tutorial

From the course: Learning CircuitPython with Circuit Playground Express

Start my 1-month free trial

Using buttons and the switch

- [Instructor] So far we've focused on controlling outputs with the microcontroller like the Onboard LED and NeoPixels. In this video, we'll start looking at inputs. Inputs, allow interaction with circuit Python. A button is one of the most common inputs and it's connected to a microcontroller pin. The microcontroller can detect whether the button is being pressed or not. The circuit playground express has two buttons, A and B. There's also a switch that works the same way but while a button is momentary and pops back to its original position after release, the switch stays in place. In circuit Python, manually setting up a button as input is similar to setting up an led for output. As you can see from this example, the main difference is using switch to input rather than switch to output after specifying the pin but like other components on the circuit playground express the CPX module…

Contents