Wire.h Library Issue

Hey guys,

Trying to get PlatformIO up and running with Atom on my MacBook, however when I try to compile a basic program using the wire.h library it throws up the following error.

/Users/me/.platformio/packages/framework-arduinoavr/libraries/__cores__/arduino/Wire/src/utility/twi.c:80:3: note: in expansion of macro 'cbi'
cbi(TWSR, TWPS0);
^

It also repeats for TWCR, TWAR, TWBR, TWDR.

My code is as follows:

#include <Arduino.h>
#include <Wire.h>

void setup() {

}

void loop() {

}

Any help would be greatly appreciated.

Cheers,

Please share here the contents of platformio.ini. Also, does it work with Arduino IDE?

Works in Arduino IDE without any errors

My platformio.ini file is as follows

[env:atmega328pb]
platform = atmelavr
board = atmega328pb
framework = arduino
lib_deps = Wire

Have tried with and without the lib_deps = wire flag and it doesn’t make any difference.

Cheers,
Dave

Which board do you use in Arduino IDE?

Stock standard uno was the setting I compiled it on in Arduino.

I’m assuming that I’ve got the right settings for this in the platformio.ini file?

Please fix “board” to “uno” in platformio.ini

That seems to have fixed it, however there is now an issue with LiquidCrystal_I2C

.platformio/lib/LiquidCrystal_I2C_ID1574/LiquidCrystal_I2C.cpp:61:30: error: no matching function for call to 'TwoWire::begin(uint8_t&, uint8_t&)'
Wire.begin(SDA_PORT,SCL_PORT);
^

Any ideas?

Thanks for you help so far :slight_smile:

Please provide a simple source code to reproduce this issue. Thanks!

Similar problem with Wire.h
PFIO getting a squiggle under &Wire in line:
"Adafruit_SSD1306 display (SCREEN_WIDTH, SCREEN HEIGHT, &Wire, OLED_RESET);
Works OK in Arduino IDE

Changing board to espdoit-devkit-v1 doing help. Works with 3 different boards in Aruino IDE, inc. this one.

I’m getting the error: Wire not declared on the scope

Try converting INO to CPP. It should help. See Redirecting...

1 Like