Wire1 from Arduino AVR-IoT-Cellular


I cannot figure out how to get this to resolve, i have included wire.h in the ini file. In reading through the code it looks like AVR_AVR128DB48 needs to be defined for WIRE1 to be defined.

How can i define AVR_AVR128DB48 in a macro and have it accessible by the underlying library?

.pio\libdeps\AVR128DB48\AVR-IoT MCP9808\src\mcp9808.cpp:5:14: error: ‘Wire1’ was not declared in this scope

Any help and or guidance would be appreciated as this is making me crazy-:).


This error is reproducable for me with

platform = atmelmegaavr
board = AVR128DB48
framework = arduino
lib_deps =

and src/main.cpp with the content from read_temp.ino. So let’s figure this one out…

Well that was easy. As can be seen in

there needs to be a macro activated to enable the Wire1 creation. Per docs that can be added using

build_flags = -DTWI_USING_WIRE1

in the platformio.ini.

Adding that the the above file makes the firmware compile without any problems.

Linking .pio\build\AVR128DB48\firmware.elf
Checking size .pio\build\AVR128DB48\firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [=         ]   5.9% (used 974 bytes from 16384 bytes)
Flash: [          ]   5.0% (used 6534 bytes from 131072 bytes)
Building .pio\build\AVR128DB48\firmware.hex
==================== [SUCCESS] Took 2.87 seconds ====================

Max, Thank you, that did it!