I had a project that was working fine. This morning I wanted to make a slight code change. When I uploaded, the include statement in my sketch showed <Wire.h> highlighted in brown with the following errors. Coincidentally enough, yesterday there was an update to Arduino IDE. Not sure if that had anything to do with it or not. Despite the error messages, it still allowed the upload to happen and the project stopped working. Tried re-adding the Wire library, as well as the AHT10 library. I had another sketch that I created for testing that is throwing the same errors as this sketch is.
/Users/zcrow/Arduino/libraries/AHT10TK/src/AHT10.cpp: In member function 'long unsigned int AHT10Class::readSensor(boolean)':
/Users/zcrow/Arduino/libraries/AHT10TK/src/AHT10.cpp:126:38: warning: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second:
126 | Wire.requestFrom(AHT10_address, 6);
| ^
In file included from /Users/zcrow/Arduino/libraries/AHT10TK/src/AHT10.cpp:29:
/Users/zcrow/Library/Arduino15/packages/esp8266/hardware/esp8266/3.0.2/libraries/Wire/Wire.h:70:13: note: candidate 1: 'uint8_t TwoWire::requestFrom(int, int)'
70 | uint8_t requestFrom(int, int);
| ^~~~~~~~~~~
/Users/zcrow/Library/Arduino15/packages/esp8266/hardware/esp8266/3.0.2/libraries/Wire/Wire.h:68:13: note: candidate 2: 'uint8_t TwoWire::requestFrom(uint8_t, uint8_t)'
68 | uint8_t requestFrom(uint8_t, uint8_t);
| ^~~~~~~~~~~
/Users/zcrow/Arduino/libraries/AHT10TK/src/AHT10.cpp: In member function 'unsigned char AHT10Class::readStatus()':
/Users/zcrow/Arduino/libraries/AHT10TK/src/AHT10.cpp:149:38: warning: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second:
149 | Wire.requestFrom(AHT10_address, 1);
| ^
In file included from /Users/zcrow/Arduino/libraries/AHT10TK/src/AHT10.cpp:29:
/Users/zcrow/Library/Arduino15/packages/esp8266/hardware/esp8266/3.0.2/libraries/Wire/Wire.h:70:13: note: candidate 1: 'uint8_t TwoWire::requestFrom(int, int)'
70 | uint8_t requestFrom(int, int);
| ^~~~~~~~~~~
/Users/zcrow/Library/Arduino15/packages/esp8266/hardware/esp8266/3.0.2/libraries/Wire/Wire.h:68:13: note: candidate 2: 'uint8_t TwoWire::requestFrom(uint8_t, uint8_t)'
68 | uint8_t requestFrom(uint8_t, uint8_t);
| ^~~~~~~~~~~
Executable segment sizes:
ICACHE : 32768 - flash instruction cache
IROM : 294184 - code in flash (default or ICACHE_FLASH_ATTR)
IRAM : 29460 / 32768 - code in IRAM (IRAM_ATTR, ISRs...)
DATA : 1576 ) - initialized variables (global, static) in RAM/HEAP
RODATA : 2612 ) / 81920 - constants (global, static) in RAM/HEAP
BSS : 26640 ) - zeroed variables (global, static) in RAM/HEAP
Quick hack:
Locate Wire.h in your library folder.
Move the requestFrom() methods with uint8_t arguments from the public section up into the private section.
/Users/zcrow/Arduino/libraries/AHT10TK/src/AHT10.cpp: In member function 'long unsigned int AHT10Class::readSensor(boolean)':
/Users/zcrow/Arduino/libraries/AHT10TK/src/AHT10.cpp:126:38: warning: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second:
126 | Wire.requestFrom(AHT10_address, 6);
| ^
In file included from /Users/zcrow/Arduino/libraries/AHT10TK/src/AHT10.cpp:29:
/Users/zcrow/Library/Arduino15/packages/esp8266/hardware/esp8266/3.0.2/libraries/Wire/Wire.h:48:13: note: candidate 1: 'uint8_t TwoWire::requestFrom(int, int)'
48 | uint8_t requestFrom(int, int);
| ^~~~~~~~~~~
/Users/zcrow/Library/Arduino15/packages/esp8266/hardware/esp8266/3.0.2/libraries/Wire/Wire.h:46:13: note: candidate 2: 'uint8_t TwoWire::requestFrom(uint8_t, uint8_t)'
46 | uint8_t requestFrom(uint8_t, uint8_t);
| ^~~~~~~~~~~
/Users/zcrow/Arduino/libraries/AHT10TK/src/AHT10.cpp:126:38: error: 'uint8_t TwoWire::requestFrom(int, int)' is private within this context
126 | Wire.requestFrom(AHT10_address, 6);
| ^
In file included from /Users/zcrow/Arduino/libraries/AHT10TK/src/AHT10.cpp:29:
/Users/zcrow/Library/Arduino15/packages/esp8266/hardware/esp8266/3.0.2/libraries/Wire/Wire.h:48:13: note: declared private here
48 | uint8_t requestFrom(int, int);
| ^~~~~~~~~~~
/Users/zcrow/Arduino/libraries/AHT10TK/src/AHT10.cpp: In member function 'unsigned char AHT10Class::readStatus()':
/Users/zcrow/Arduino/libraries/AHT10TK/src/AHT10.cpp:149:38: warning: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second:
149 | Wire.requestFrom(AHT10_address, 1);
| ^
In file included from /Users/zcrow/Arduino/libraries/AHT10TK/src/AHT10.cpp:29:
/Users/zcrow/Library/Arduino15/packages/esp8266/hardware/esp8266/3.0.2/libraries/Wire/Wire.h:48:13: note: candidate 1: 'uint8_t TwoWire::requestFrom(int, int)'
48 | uint8_t requestFrom(int, int);
| ^~~~~~~~~~~
/Users/zcrow/Library/Arduino15/packages/esp8266/hardware/esp8266/3.0.2/libraries/Wire/Wire.h:46:13: note: candidate 2: 'uint8_t TwoWire::requestFrom(uint8_t, uint8_t)'
46 | uint8_t requestFrom(uint8_t, uint8_t);
| ^~~~~~~~~~~
/Users/zcrow/Arduino/libraries/AHT10TK/src/AHT10.cpp:149:38: error: 'uint8_t TwoWire::requestFrom(int, int)' is private within this context
149 | Wire.requestFrom(AHT10_address, 1);
| ^
In file included from /Users/zcrow/Arduino/libraries/AHT10TK/src/AHT10.cpp:29:
/Users/zcrow/Library/Arduino15/packages/esp8266/hardware/esp8266/3.0.2/libraries/Wire/Wire.h:48:13: note: declared private here
48 | uint8_t requestFrom(int, int);
| ^~~~~~~~~~~
exit status 1
Compilation error: exit status 1
I tried it with a different sketch that also used wire.h and the aht10.h and it threw warnings, but I'm getting output on the serial monitor.
/Users/zcrow/Arduino/libraries/AHT10TK/src/AHT10.cpp: In member function 'long unsigned int AHT10Class::readSensor(boolean)':
/Users/zcrow/Arduino/libraries/AHT10TK/src/AHT10.cpp:126:38: warning: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second:
126 | Wire.requestFrom(AHT10_address, 6);
| ^
In file included from /Users/zcrow/Arduino/libraries/AHT10TK/src/AHT10.cpp:29:
/Users/zcrow/Library/Arduino15/packages/esp8266/hardware/esp8266/3.0.2/libraries/Wire/Wire.h:70:13: note: candidate 1: 'uint8_t TwoWire::requestFrom(int, int)'
70 | uint8_t requestFrom(int, int);
| ^~~~~~~~~~~
/Users/zcrow/Library/Arduino15/packages/esp8266/hardware/esp8266/3.0.2/libraries/Wire/Wire.h:68:13: note: candidate 2: 'uint8_t TwoWire::requestFrom(uint8_t, uint8_t)'
68 | uint8_t requestFrom(uint8_t, uint8_t);
| ^~~~~~~~~~~
/Users/zcrow/Arduino/libraries/AHT10TK/src/AHT10.cpp: In member function 'unsigned char AHT10Class::readStatus()':
/Users/zcrow/Arduino/libraries/AHT10TK/src/AHT10.cpp:149:38: warning: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second:
149 | Wire.requestFrom(AHT10_address, 1);
| ^
In file included from /Users/zcrow/Arduino/libraries/AHT10TK/src/AHT10.cpp:29:
/Users/zcrow/Library/Arduino15/packages/esp8266/hardware/esp8266/3.0.2/libraries/Wire/Wire.h:70:13: note: candidate 1: 'uint8_t TwoWire::requestFrom(int, int)'
70 | uint8_t requestFrom(int, int);
| ^~~~~~~~~~~
/Users/zcrow/Library/Arduino15/packages/esp8266/hardware/esp8266/3.0.2/libraries/Wire/Wire.h:68:13: note: candidate 2: 'uint8_t TwoWire::requestFrom(uint8_t, uint8_t)'
68 | uint8_t requestFrom(uint8_t, uint8_t);
| ^~~~~~~~~~~
Executable segment sizes:
ICACHE : 32768 - flash instruction cache
IROM : 240676 - code in flash (default or ICACHE_FLASH_ATTR)
IRAM : 27913 / 32768 - code in IRAM (IRAM_ATTR, ISRs...)
DATA : 1516 ) - initialized variables (global, static) in RAM/HEAP
RODATA : 936 ) / 81920 - constants (global, static) in RAM/HEAP
BSS : 26152 ) - zeroed variables (global, static) in RAM/HEAP
Which AHT10 library do you use ?
I suggest to keep Wire.h original and change the I2C address to 'int'.
In the AHT10.h file, change this:
uint8_t _address;
to this:
int _address;
Then everything is 'int'. If you use a other library, change the 'AHT10_address' to 'int'.
I'm afraid there will no solution. The parameter types are different on different platforms. I can not find that someone set a goal to solve this. It just lingers on
My opinion is that the sketch should be simple and that the Wire library should deal with every combination of 'int' and 'uin8_t'.
I am using a different AHT10 library. Seems that something happened recently and the old library isn't working as it should. The new library has stopped throwing any warnings.