PyRasp

← All practice problems

Raspberry Pi Pico practice problem · Raspberry Pi Pico

Find the sensor

MediumBudget $12MicroPython

An MPU-6050 is wired to the Pico: SDA on GP4, SCL on GP5, VCC on 3V3 and GND. The board has no fixed I²C pins, so the program names the pair:

from machine import I2C, Pin
bus = I2C(0, sda=Pin(4), scl=Pin(5))
  1. Print the addresses that answer bus.scan() — the sensor is at 0x68 (104).
  2. Read its WHO_AM_I register (0x75) and print the number. It should be 104.

Two numbers, one per line: the list of addresses, then the identity.

More in Raspberry Pi Pico