# MicroPython Hardware: Digital I/O

## Overview

Warning: Note this guide was written for MicroPython.org firmware and not Adafruit CircuitPython firmware.

Info: This guide was written for older MicroPython versions. Please see current MicroPython documentation for the latest usage.

![](https://cdn-learn.adafruit.com/assets/assets/000/035/373/medium800/microcontrollers_IMG_5147.jpg?1472803814)

https://www.youtube.com/watch?v=-kVW8yffe0c

Digital I/O, or input/output, is one of the most basic ways to talk to hardware. &nbsp;We say 'digital' because it only deals with **on** or&nbsp; **off** values and nothing in-between. &nbsp;For example with digital I/O a LED can be turned completely on and completely off repeatedly to blink. &nbsp;Or using digital I/O you can read when a switch or button is moved&nbsp;on or off. &nbsp;With just a few lines of MicroPython code you'll be a master of digital I/O in no time.

This guide explores how to use digital I/O pins with MicroPython. &nbsp;You'll see how to control a LED using a digital output pin, and read a pushbutton using a digital input pin. &nbsp;These basic digital I/O examples can serve as the starting point for more complex and interesting projects that use hardware like LEDs, buttons, switches, relays, transistors, and even simple digital sensors!

Before you get started you'll want to be familiar with the basics of using MicroPython by reading these guides:

- [MicroPython Basics: What is MicroPython?](../../../../micropython-basics-what-is-micropython/overview)
- [MicroPython Basics: How to Load MicroPython on a Board](../../../../micropython-basics-how-to-load-micropython-on-a-board)
- [MicroPython Basics: Blink a LED](../../../../micropython-basics-blink-a-led/overview)
- [MicroPython Basics: Load Files & Run Code](../../../../micropython-basics-load-files-and-run-code/overview)

- [Next Page](https://learn.adafruit.com/micropython-hardware-digital-i-slash-o/digital-outputs.md)

## Featured Products

### Adafruit Parts Pal

[Adafruit Parts Pal](https://www.adafruit.com/product/2975)
[LEDs](https://www.adafruit.com/categories/90) and [passives](https://www.adafruit.com/categories/156) and [transistors](https://www.adafruit.com/categories/153) and [switches](https://www.adafruit.com/categories/155) and op-amps oh my!&nbsp;The...

Out of Stock
[Buy Now](https://www.adafruit.com/product/2975)
[Related Guides to the Product](https://learn.adafruit.com/products/2975/guides)
### MicroPython pyboard

[MicroPython pyboard](https://www.adafruit.com/product/2390)
The **pyboard** is a compact and powerful electronics development board that runs MicroPython. It connects to your PC over USB, giving you a USB flash drive to save your Python scripts, and a serial Python prompt (a REPL) for instant programming. Requires a micro USB cable, and...

In Stock
[Buy Now](https://www.adafruit.com/product/2390)
[Related Guides to the Product](https://learn.adafruit.com/products/2390/guides)
### Adafruit Feather HUZZAH with ESP8266 - Loose Headers

[Adafruit Feather HUZZAH with ESP8266 - Loose Headers](https://www.adafruit.com/product/2821)
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; **Adafruit Feather HUZZAH ESP8266** &nbsp;- our take on an...

In Stock
[Buy Now](https://www.adafruit.com/product/2821)
[Related Guides to the Product](https://learn.adafruit.com/products/2821/guides)
### Adafruit HUZZAH ESP8266 Breakout

[Adafruit HUZZAH ESP8266 Breakout](https://www.adafruit.com/product/2471)
Add Internet to your next project with an adorable, bite-sized WiFi microcontroller, at a price you like! The ESP8266 processor from Espressif is an 80 MHz microcontroller with a full WiFi front-end (both as client and access point) and TCP/IP stack with DNS support as well. While this chip...

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

[ESP8266 WiFi Module](https://www.adafruit.com/product/2282)
This interesting module is a lot of fun for hobbyists and students who are interested in experimenting with the ESP8266 WiFi chipset. We bought a bunch of these modules, updated the firmware to the much-easier-to-use v0.924 and wrote some Arduino code to grab a webpage.

We do not...

No Longer Stocked
[Buy Now](https://www.adafruit.com/product/2282)
[Related Guides to the Product](https://learn.adafruit.com/products/2282/guides)
### WiPy 1.0 - IoT Development Platform

[WiPy 1.0 - IoT Development Platform](https://www.adafruit.com/product/3184)
The **WiPy** is an enterprise grade IOT development platform &nbsp;that runs Python in real time with the perfect blend of power, speed, friendliness, and flexibility. Within a few minutes you can wirelessly connect to it and get a Python REPL command line.

In addition to...

No Longer Stocked
[Buy Now](https://www.adafruit.com/product/3184)
[Related Guides to the Product](https://learn.adafruit.com/products/3184/guides)
### Teensy 3.2 + header

[Teensy 3.2 + header](https://www.adafruit.com/product/2756)
[Teensy](http://www.pjrc.com/teensy/index.html) 3.2&nbsp;is a small, breadboard-friendly development board designed by Paul Stoffregen and PJRC. Teensy 3.2&nbsp;brings a low-cost 32 bit ARM Cortex-M4 platform to hobbyists, students and engineers, using an adapted version of the...

No Longer Stocked
[Buy Now](https://www.adafruit.com/product/2756)
[Related Guides to the Product](https://learn.adafruit.com/products/2756/guides)
### Tactile Button switch (6mm) x 20 pack

[Tactile Button switch (6mm) x 20 pack](https://www.adafruit.com/product/367)
Little clicky switches are standard input "buttons" on electronic projects. These work best in a PCB but [can be used on a solderless breadboard as shown in this tutorial](https://learn.adafruit.com/adafruit-arduino-lesson-6-digital-inputs?view=all). The pins are normally...

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

## Related Guides

- [Adafruit Feather HUZZAH ESP8266](https://learn.adafruit.com/adafruit-feather-huzzah-esp8266.md)
- [Adafruit IO Basics: ESP8266 + Arduino](https://learn.adafruit.com/adafruit-io-basics-esp8266-arduino.md)
- [CircuitPython Hardware: LED Backpacks & FeatherWings](https://learn.adafruit.com/micropython-hardware-led-backpacks-and-featherwings.md)
- [Using IFTTT with Adafruit IO to Make an IoT Door Detector](https://learn.adafruit.com/using-ifttt-with-adafruit-io.md)
- [MAC Address Finder](https://learn.adafruit.com/mac-address-finder.md)
- [MicroPython Basics: How to Load MicroPython on a Board](https://learn.adafruit.com/micropython-basics-how-to-load-micropython-on-a-board.md)
- [Gmailbox](https://learn.adafruit.com/gmailbox.md)
- [Feather Weather Lamp](https://learn.adafruit.com/feather-weather-lamp.md)
- [Ninja Timer: Giant 7-Segment Display](https://learn.adafruit.com/ninja-timer-giant-7-segment-display.md)
- [MicroPython Hardware: Analog I/O](https://learn.adafruit.com/micropython-hardware-analog-i-o.md)
- [Multi-tasking with CircuitPython](https://learn.adafruit.com/multi-tasking-with-circuitpython.md)
- [MicroPython Hardware: I2C Devices](https://learn.adafruit.com/micropython-hardware-i2c-devices.md)
- [MicroPython Smart Holiday Lights](https://learn.adafruit.com/micropython-smart-holiday-lights.md)
- [MicroPython Basics: Blink a LED](https://learn.adafruit.com/micropython-basics-blink-a-led.md)
- [All the Internet of Things - Episode Two: Protocols](https://learn.adafruit.com/alltheiot-protocols.md)
- [Adding a WiFi Co-Processor to CircuitPython](https://learn.adafruit.com/adding-a-wifi-co-processor-to-circuitpython-esp8266-esp32.md)
