0
votes

I am trying to change the wires i2c pins to 11,12 (SDA, SCL). I built my own PCB but do not have the i2c lines in the same location. I used adafruits feather52 bootloader.

I found online that changing the variant.h file changes the i2c lines, but I don't have that file on my computer (PC), although my mac does.

I have tried the Wire.begin(SDA, SCL) though that's for the esps

I also tried to edit the wire.h files in both the default wire under C/programs/Arduino and the one under user/AppData/Arduino/adafruit though I haven't found where the pins are set.

3

3 Answers

0
votes

You can't change the hardware I2C pins. They are hardware. That means that they are physically connected inside the chip to the part that drives the I2C. You can use a software I2C to "bit-bang" your communication. But that won't use the regular wire library.

0
votes

You have a solution though. I was facing the same problem two years ago, and what I ended up doing was using software I2C. It "Bit Bangs" the I2C protocol on any digital pins of Arduino. There are couple of libraries for that. For example, check this one: https://github.com/Testato/SoftwareWire

Start reading about I2C protocol and try to understand what the library is doing. Then it is possible to simulate the I2C protocol on the GPIO pins you have hardwired

0
votes

The hardware packages are istalled into the Arduino15 folder. The location of the folder on Windows is in users home directory in C:\Users\\AppData\Local\Arduino15\packages.

The variant file is in variants/feather_nrf52832/variant.h

The nRF52 MCU can use any pair of pins for I2C.

So try to change in variant.h

#define PIN_WIRE_SDA         (25u)
#define PIN_WIRE_SCL         (26u)

to pins you need.

If it works, consider to define your own hardware definition instead of patching the variant.h.