All tutorials

4 · Displays & buses

Scan the I²C bus

Advanced15 min

Goal

List the addresses of the devices present on the bus.

Why it matters

The first troubleshooting reflex: knowing who actually answers on the bus.

Steps

  1. 01Place several I²C components on the canvas.
  2. 02Sweep addresses 1 to 126 with a for loop.
  3. 03Test each address with beginTransmission()/endTransmission().
  4. 04Print those answering 0.

This tutorial runs inside the Circuitly simulator: your wiring and your code are checked automatically at every step.

Next tutorials