# CircuitPython Basics: Digital Inputs & Outputs

## Digital Signals

Primary: This guide is older. You'll likely want to see the more complete guide CircuitPython Essentials which has a Digital IO section and more.

### CircuitPython Essentials - CircuitPython Digital In & Out

[CircuitPython Essentials](https://learn.adafruit.com/circuitpython-essentials)
[CircuitPython Digital In & Out](https://learn.adafruit.com/circuitpython-essentials/circuitpython-digital-in-out)
https://www.youtube.com/watch?v=ZJJ4WkPRddc

Digital inputs and outputs (or I/O) are some of the simplest and most powerful ways to interact with hardware. Using digital I/O you can talk to devices with simple on and off signals, like turning a LED on/off or reading if a button is pressed. In CircuitPython using digital I/O is easy with a few modules that this guide will explore.

# Digital Signals

Before diving in to how to digital I/O works you’ll want to understand what is a digital signal. In the simplest sense a digital signal is a simple on or off signal–i.e. there are only two possible states for the signal to be in. Think of this almost like a binary digit that’s either 0 or 1. With a digital signal it can only ever be 0/off or 1/on, there is no in-between!

At a physical level digital signals are represented with high and low voltage levels. A digital signal that’s on will be at a ‘high’ voltage level, typically 3.3 volts or more (depending on the specifications of your microprocessor or development board), and a signal that’s off will be at a ‘low’ voltage level of zero volts (also called ground). You can actually see this voltage with a multimeter set to measure DC voltage–try connecting a multimeter to a button or LED and watch the voltage as digital signal changes from on to off and vice-versa.

# Examples of Digital Signals

What can you do with a digital signal? It turns out quite a few interesting components are controlled with simple on/off digital I/O!

Digital inputs:

- [Buttons and switches](https://www.adafruit.com/category/155)
- [Magnetic or hall-effect sensors](https://www.adafruit.com/product/158)
- [PIR motion sensors](https://www.adafruit.com/product/189)
- [Simple vibration sensors](https://www.adafruit.com/product/1766)
- [Beam-break sensors](https://www.adafruit.com/product/2167)
- [Liquid level sensors](https://www.adafruit.com/product/3397)
- [Tilt switches](https://www.adafruit.com/product/173)
- [Simple wireless remote controls](https://www.adafruit.com/product/1096)

Digital outputs:

- [Single color LEDs](https://www.adafruit.com/category/90)
- [Relays to control high-power devices](https://www.adafruit.com/product/2935)
- [Solenoids that push or pull objects](https://www.adafruit.com/product/2776)
- [Vibration motors](https://www.adafruit.com/product/1201)
- [Buzzers (not piezo buzzers that require an analog signal though!)](https://www.adafruit.com/product/1536)

In addition to devices like the above you can also use digital signals for simple communication between two devices. A digital output of one device, like your development board, can be connected to another device’s digital input, like an [audio FX board](https://www.adafruit.com/product/2217) that plays music and sound effects. There are even fast protocols like I2C or SPI for sending large amounts of data over a digital signal, but we’ll cover those in a later guide.

- [Next Page](https://learn.adafruit.com/circuitpython-digital-inputs-and-outputs/following-along-in-the-repl.md)

## Featured Products

### Circuit Playground Express

[Circuit Playground Express](https://www.adafruit.com/product/3333)
 **Circuit Playground Express** is the next step towards a perfect introduction to electronics and programming. We've taken the original Circuit Playground Classic and made it even better! Not only did we pack even more sensors in, we also made it even easier to...

In Stock
[Buy Now](https://www.adafruit.com/product/3333)
[Related Guides to the Product](https://learn.adafruit.com/products/3333/guides)
### Adafruit METRO M0 Express - designed for CircuitPython

[Adafruit METRO M0 Express - designed for CircuitPython](https://www.adafruit.com/product/3505)
Metro is our series of microcontroller boards for use with the Arduino IDE. This new **Metro M0 Express** board looks a whole lot like our&nbsp;[original Metro 328](https://www.adafruit.com/product/2488), but with a huge upgrade. Instead of the ATmega328, this Metro...

In Stock
[Buy Now](https://www.adafruit.com/product/3505)
[Related Guides to the Product](https://learn.adafruit.com/products/3505/guides)
### Adafruit Feather M0 Express

[Adafruit Feather M0 Express](https://www.adafruit.com/product/3403)
At the Feather M0's heart is an ATSAMD21G18 ARM Cortex M0+ processor, clocked at 48 MHz and at 3.3V logic, the same one used in the new&nbsp;[Arduino Zero](https://www.adafruit.com/products/2843). This chip has a whopping 256K of FLASH (8x more than the Atmega328 or 32u4) and...

Out of Stock
[Buy Now](https://www.adafruit.com/product/3403)
[Related Guides to the Product](https://learn.adafruit.com/products/3403/guides)
### Adafruit Feather M0 Basic Proto - ATSAMD21 Cortex M0

[Adafruit Feather M0 Basic Proto - ATSAMD21 Cortex M0](https://www.adafruit.com/product/2772)
Feather is the new development board from Adafruit, and like its namesake it is thin, light, and lets you fly! We designed Feather to be a new standard for portable microcontroller cores.

This is the&nbsp; **Feather M0 Basic Proto** ,&nbsp;it has a bunch of prototyping space...

In Stock
[Buy Now](https://www.adafruit.com/product/2772)
[Related Guides to the Product](https://learn.adafruit.com/products/2772/guides)
### Adafruit GEMMA M0 - Miniature wearable electronic platform

[Adafruit GEMMA M0 - Miniature wearable electronic platform](https://www.adafruit.com/product/3501)
The **Adafruit Gemma M0** is a super small microcontroller board, with just enough built-in to create many simple projects. It may look small and cute: round, about the size of a quarter, with friendly alligator-clip sew pads. But do not be fooled! The Gemma M0 is incredibly...

In Stock
[Buy Now](https://www.adafruit.com/product/3501)
[Related Guides to the Product](https://learn.adafruit.com/products/3501/guides)
### Adafruit Trinket M0 - for use with CircuitPython & Arduino IDE

[Adafruit Trinket M0 - for use with CircuitPython & Arduino IDE](https://www.adafruit.com/product/3500)
The&nbsp;Adafruit Trinket M0 may be small, but do not be fooled by its size! It's a tiny microcontroller board, built around the Atmel ATSAMD21, a little chip with _a lot_ of power. We wanted to design a microcontroller board that was small enough to fit into any project, and low...

Out of Stock
[Buy Now](https://www.adafruit.com/product/3500)
[Related Guides to the Product](https://learn.adafruit.com/products/3500/guides)
### Super Bright Red 5mm LED (25 pack)

[Super Bright Red 5mm LED (25 pack)](https://www.adafruit.com/product/297)
Need some really bright LEDs? We are big fans of these clear red LEDs, in fact we use them exclusively in our kits. They are very bright and have about 20degree LED beam. They go easily into a breadboard and will add that extra zing to your project.

- Pack of 25 clear red...

In Stock
[Buy Now](https://www.adafruit.com/product/297)
[Related Guides to the Product](https://learn.adafruit.com/products/297/guides)
### Through-Hole Resistors - 470 ohm 5% 1/4W - Pack of 25

[Through-Hole Resistors - 470 ohm 5% 1/4W - Pack of 25](https://www.adafruit.com/product/2781)
ΩMG! You're not going to be able to resist these handy resistor packs!&nbsp;Well, axially, they&nbsp;do all of the resisting for you!

This is a **25 Pack of 470Ω Resistors.** More specifically, they are **carbon film** , through-hole...

In Stock
[Buy Now](https://www.adafruit.com/product/2781)
[Related Guides to the Product](https://learn.adafruit.com/products/2781/guides)

## Related Guides

- [Adafruit Feather M0 Express](https://learn.adafruit.com/adafruit-feather-m0-express-designed-for-circuit-python-circuitpython.md)
- [Adafruit Metro M0 Express](https://learn.adafruit.com/adafruit-metro-m0-express.md)
- [Adafruit Trinket M0](https://learn.adafruit.com/adafruit-trinket-m0-circuitpython-arduino.md)
- [Adafruit Circuit Playground Express](https://learn.adafruit.com/adafruit-circuit-playground-express.md)
- [Hacking Ikea Lamps with Circuit Playground Express](https://learn.adafruit.com/hacking-ikea-lamps-with-circuit-playground-express.md)
- [Dancing Inflatables: Make your Holiday Display Move](https://learn.adafruit.com/dancing-inflatables-make-your-holiday-display-move.md)
- [Mini Commodore PET with Charlieplexed LED Matrix](https://learn.adafruit.com/mini-commodore-pet-with-charlieplexed-led-matrix.md)
- [Steven Universe Cosplay Shirt & Gem](https://learn.adafruit.com/steven-universe-cosplay-shirt-gem.md)
- [NeoPixel Spats with Gemma and MakeCode](https://learn.adafruit.com/neopixel-spats.md)
- [Light Up Paper Dragon Wall Sconce](https://learn.adafruit.com/light-up-paper-dragon-wall-sconce.md)
- [Textile Potentiometer Hoodie](https://learn.adafruit.com/textile-potentiometer-hoodie.md)
- [Creating and sharing a CircuitPython library](https://learn.adafruit.com/creating-and-sharing-a-circuitpython-library.md)
- [CircuitPython Hardware: Charlieplex LED Matrix](https://learn.adafruit.com/micropython-hardware-charlieplex-led-matrix.md)
- [CircuitPython Basics: Analog Inputs & Outputs](https://learn.adafruit.com/circuitpython-basics-analog-inputs-and-outputs.md)
- [The Tilt Trumpet](https://learn.adafruit.com/the-tilt-trumpet.md)
- [Trellis Feather DSP-G1 Synthesizer](https://learn.adafruit.com/feather-trellis-dsp-g1-synthesizer.md)
- [Clockwork Goggles](https://learn.adafruit.com/gemma-m0-clockwork-goggles.md)
- [LED NeoPixel Corset with Circuit Playground Express and MakeCode](https://learn.adafruit.com/led-corset-with-circuit-playground-and-makecode.md)
- [Qu'est-ce que MakeCode?](https://learn.adafruit.com/makecode-fr.md)
