Overview

The ESP32 supports a wide range of peripherals, many of them supported directly by Toit, like the I2C protocol, the SPI communication interface, and GPIO pins.

Selecting the right protocol

Many chips support both SPI and I2C. While Toit makes it easy to write drivers that are usable by both, there are some clear advantages and disadvantages between the two.

I2C

  • Supports longer distances
  • Only requires two wires

SPI

  • Is significantly faster
  • Frequency configurable per device, not the bus

GPIO

With Toit, working with General-Purpose Input/Output (GPIO) pins is easy and they can be configured and manipulated at runtime. In the GPIO section you'll learn how to use the GPIO pins with Toit.