Error 'class TwoWire' has no member named 'setSDA'

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
rickseiden
 
Posts: 66
Joined: Thu Oct 06, 2016 2:48 pm

Error 'class TwoWire' has no member named 'setSDA'

Post by rickseiden »

I'm trying to compile a program that uses the Adafruit_GFX library, and I keep getting an error. I decided to take it back a step and not use my program or even my board.

I am now trying to compile the i2c_address_detect example in the Adafruit BusIO folder. I have made no changes to it. I have selected the Adafruit Metro board to compile against. All my boards and my libraries are up to date. I am running the "older" IDE, version 1.8.19 under Windows 11. (I just like the older IDE better.)

When I try to compile the program, I get the following error message:

Code: Select all

C:\Users\rick\Documents\Arduino\libraries\Adafruit_BusIO\Adafruit_I2CDevice.cpp: In member function 'void Adafruit_I2CDevice::setPins(uint8_t, uint8_t)':
C:\Users\rick\Documents\Arduino\libraries\Adafruit_BusIO\Adafruit_I2CDevice.cpp:41:10: error: 'class TwoWire' has no member named 'setSDA'
   _wire->setSDA(sda);
          ^~~~~~
C:\Users\rick\Documents\Arduino\libraries\Adafruit_BusIO\Adafruit_I2CDevice.cpp:42:10: error: 'class TwoWire' has no member named 'setSCL'
   _wire->setSCL(scl);
          ^~~~~~
Multiple libraries were found for "Wire.h"
 Used: C:\Users\rick\AppData\Local\Arduino15\packages\adafruit\hardware\avr\1.4.15\libraries\Wire
 Not used: C:\Users\rick\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\libraries\Wire
Again, I'm using the i2c_address_detect example without changes, the Metro board as my target, IDE 1.8.19 under Windows 11 and all my boards and libraries are up to day.

I also will say that when I try examples from the Wire folder, such as digital_potentiometer, they compile without an issue.

Does anyone know what might be causing this?

Thanks!

PS: In case anyone wants to see the code from the example:

Code: Select all

#include <Adafruit_I2CDevice.h>

Adafruit_I2CDevice i2c_dev = Adafruit_I2CDevice(0x10);

void setup() {
  while (!Serial) { delay(10); }
  Serial.begin(115200);
  Serial.println("I2C address detection test");

  if (!i2c_dev.begin()) {
    Serial.print("Did not find device at 0x");
    Serial.println(i2c_dev.address(), HEX);
    while (1);
  }
  Serial.print("Device found on address 0x");
  Serial.println(i2c_dev.address(), HEX);
}

void loop() {
  
}

User avatar
dastels
 
Posts: 15670
Joined: Tue Oct 20, 2015 3:22 pm

Re: Error 'class TwoWire' has no member named 'setSDA'

Post by dastels »

Start by making sure all board support packages and libraries are up to date.

Dave

User avatar
rickseiden
 
Posts: 66
Joined: Thu Oct 06, 2016 2:48 pm

Re: Error 'class TwoWire' has no member named 'setSDA'

Post by rickseiden »

All libraries are up to date. All boards are up to date. I'm not sure if board supports are different than boards. But in boards manager, everything is up to date.

User avatar
klcobley
 
Posts: 8
Joined: Tue Jul 26, 2016 10:27 am

Re: Error 'class TwoWire' has no member named 'setSDA'

Post by klcobley »

Although all libraries are up to date, your code is using the older of the two copies of Wire.h

User avatar
rickseiden
 
Posts: 66
Joined: Thu Oct 06, 2016 2:48 pm

Re: Error 'class TwoWire' has no member named 'setSDA'

Post by rickseiden »

klcobley wrote: Thu May 04, 2023 11:21 am Although all libraries are up to date, your code is using the older of the two copies of Wire.h
I don't know how that's possible (not saying it isn't).

I ended up downloading the zip version of the IDE, putting it on a USB drive in "portable mode", installing only the boards and libraries I need, and it compiled without a problem. I didn't even copy and paste the code. I just opened the sketch as it was.

I honestly think, at this point, that it's something in my Arduino 15 folder, and not at all related to the Adafruit_BusIO library.

User avatar
rickseiden
 
Posts: 66
Joined: Thu Oct 06, 2016 2:48 pm

Re: Error 'class TwoWire' has no member named 'setSDA'

Post by rickseiden »

klcobley wrote: Thu May 04, 2023 11:21 am Although all libraries are up to date, your code is using the older of the two copies of Wire.h
I still don't know how this is possible, but I deleted about 20 libraries that I had on the portable version from my installed version, then copied the libraries from the portable version to my installed version, and now it works, so something was sticking around where it shouldn't have.

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino”