Adafruit qt py rp2040 i2c selection

Hi. I'm trying to select the i2c interface for the qwiic cable on the qt py rp2040. I found this bit of code for defining a custom wire interface:

TwoWire Wire(&sercom1, A1, A2);

But I cant figure out what &sercom1 is. Because it is not defined anywhere in there code i think it is because the tutorial is for the atsamd21 and not the rp2040. Does anybody know how to fix this?

Tutorial I'm using: Creating a new Wire | Using ATSAMD21 SERCOM for more SPI, I2C and Serial ports | Adafruit Learning System

What board support are you using? The Adafruit site says there is no Arduino support at the moment for this board.

Im using this board extension for arduino which has a specific option for the "qt py rp2040 by adafruit"

extension:GitHub - earlephilhower/arduino-pico: Raspberry Pi Pico Arduino core, for all RP2040 boards

I looked at the source files and believe you should be able to just use Wire and Wire1 for the two I2C interfaces. The pins have been configured for you in the pins_arduino.h and the interfaces have been declared in the Wire.cpp file. Just include Wire.h and then call Wire.begin() or Wire1.begin().

1 Like

Thanks that works!

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.