Compile error from seeed_xiao_esp32c3/CST816S/CST816S.cpp:173:38

There is an ambiguous call coming from this library. It calls with a u_int32_t argument for which there is no corresponding overoad in function “requestFrom” in the Wire library. Can you fix this?

Here is my program, I’m using PlatformIO:

#include <Arduino.h>

#include <Wire.h>

#include <Adafruit_I2CDevice.h>

#include <Adafruit_I2CRegister.h>

#include “Adafruit_MCP9600.h”

#define I2C_ADDRESS (0x67)

Adafruit_MCP9600 mcp;

void setup()

{

Serial.begin(115200);

while (!Serial) {

  delay(10);

}

Serial.println("MCP9600 HW test");

/* Initialise the driver with I2C_ADDRESS and the default I2C bus. */

if (! mcp.begin(I2C_ADDRESS)) {

    Serial.println("Sensor not found. Check wiring!");

    while (1);

}

Serial.println(“Found MCP9600!”);

mcp.setADCresolution(MCP9600_ADCRESOLUTION_18);

Serial.print("ADC resolution set to ");

switch (mcp.getADCresolution()) {

case MCP9600_ADCRESOLUTION_18:   Serial.print("18"); break;

case MCP9600_ADCRESOLUTION_16:   Serial.print("16"); break;

case MCP9600_ADCRESOLUTION_14:   Serial.print("14"); break;

case MCP9600_ADCRESOLUTION_12:   Serial.print("12"); break;

}

Serial.println(" bits");

mcp.setThermocoupleType(MCP9600_TYPE_K);

Serial.print("Thermocouple type set to ");

switch (mcp.getThermocoupleType()) {

case MCP9600_TYPE_K:  Serial.print("K"); break;

case MCP9600_TYPE_J:  Serial.print("J"); break;

case MCP9600_TYPE_T:  Serial.print("T"); break;

case MCP9600_TYPE_N:  Serial.print("N"); break;

case MCP9600_TYPE_S:  Serial.print("S"); break;

case MCP9600_TYPE_E:  Serial.print("E"); break;

case MCP9600_TYPE_B:  Serial.print("B"); break;

case MCP9600_TYPE_R:  Serial.print("R"); break;

}

Serial.println(" type");

mcp.setFilterCoefficient(3);

Serial.print("Filter coefficient value set to: ");

Serial.println(mcp.getFilterCoefficient());

mcp.setAlertTemperature(1, 30);

Serial.print("Alert #1 temperature set to ");

Serial.println(mcp.getAlertTemperature(1));

mcp.configureAlert(1, true, true); // alert 1 enabled, rising temp

mcp.enable(true);

Serial.println(F("------------------------------"));

}

void loop()

{

Serial.print("Hot Junction: "); Serial.println(mcp.readThermocouple());

Serial.print("Cold Junction: "); Serial.println(mcp.readAmbient());

Serial.print(“ADC: “); Serial.print(mcp.readADC() * 2); Serial.println(” uV”);

delay(1000);

}

Hi there,
Can you use the code tags above :point_up_2:, so this is legible? When you say from “this” Lib which are you referring to it’s not obvious from my POV? Also what BSP are you using and Have you tried rolling that back? Is it the wire.lib ?
does it compile in Arduino IDE?
What’s the Platform .ini looking like?
Need more info and if you provide it, I’m confident the smart folks here will answer.
HTH
GL :slight_smile: PJ :v:

I don’t know about “code tags”, I put the files you asked for in *.TXT files but text files aren’t on the “approved for upload” list.
Sorry I don’t use Arduino IDE any longer, outgrew it ( - :slight_smile:
So coach me some more and we can get there.

Assuming you can use the program I’ve already submitted here is the PLATFORM.INI file:

; PlatformIO Project Configuration File
;
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; Redirecting...

[env:seeed_xiao_esp32c3]
platform = espressif32
board = seeed_xiao_esp32c3
framework = arduino
lib_deps = adafruit/Adafruit MCP9600 Library@^2.0.2

Missed one question you asked, which file is the error in? It is in the subject line. Line 173 of file CST816S.CPP

Hi there,
Yea, Well maybe like many grew up TOO fast! LOL :face_with_open_eyes_and_hand_over_mouth:
edit your post and use the </> above, you paste it in there and it looks like code then.
a *.txt file would be require more steps to duplicate your issue and help you…
I use PLio for Debugging I’m very familiar with the ini. (yours looks pretty sparse) :face_with_peeking_eye:

by now I could have pasted it in Arduino IDE and compiled it eliminating the extra LIB’s and it would probably work. You should try that.
You didn’t say which bsp VERSION you are using for the ESP32C3 is it the latest?
Pause…( I go looking)
OK so after what 5 minutes I found the Adafruit docs, loaded the code and Library. no issues?
compiles AOK.
Here it is the correct way!

#include <Wire.h>
#include <Adafruit_I2CDevice.h>
#include <Adafruit_I2CRegister.h>
#include "Adafruit_MCP9600.h"
#define I2C_ADDRESS (0x67)
Adafruit_MCP9600 mcp;
void setup() {
  Serial.begin(115200);
  while (!Serial) {
    delay(10);
  }
  Serial.println("MCP9600 HW test");
  /* Initialise the driver with I2C_ADDRESS and the default I2C bus. */
  if (!mcp.begin(I2C_ADDRESS)) {
    Serial.println("Sensor not found. Check wiring!");
    while (1)
      ;
  }
  Serial.println("Found MCP9600!");
  mcp.setADCresolution(MCP9600_ADCRESOLUTION_18);
  Serial.print("ADC resolution set to ");
  switch (mcp.getADCresolution()) {
    case MCP9600_ADCRESOLUTION_18: Serial.print("18"); break;
    case MCP9600_ADCRESOLUTION_16: Serial.print("16"); break;
    case MCP9600_ADCRESOLUTION_14: Serial.print("14"); break;
    case MCP9600_ADCRESOLUTION_12: Serial.print("12"); break;
  }
  Serial.println(" bits");
  mcp.setThermocoupleType(MCP9600_TYPE_K);
  Serial.print("Thermocouple type set to ");
  switch (mcp.getThermocoupleType()) {
    case MCP9600_TYPE_K: Serial.print("K"); break;
    case MCP9600_TYPE_J: Serial.print("J"); break;
    case MCP9600_TYPE_T: Serial.print("T"); break;
    case MCP9600_TYPE_N: Serial.print("N"); break;
    case MCP9600_TYPE_S: Serial.print("S"); break;
    case MCP9600_TYPE_E: Serial.print("E"); break;
    case MCP9600_TYPE_B: Serial.print("B"); break;
    case MCP9600_TYPE_R: Serial.print("R"); break;
  }
  Serial.println(" type");
  mcp.setFilterCoefficient(3);
  Serial.print("Filter coefficient value set to: ");
  Serial.println(mcp.getFilterCoefficient());
  mcp.setAlertTemperature(1, 30);
  Serial.print("Alert #1 temperature set to ");
  Serial.println(mcp.getAlertTemperature(1));
  mcp.configureAlert(1, true, true);  // alert 1 enabled, rising temp
  mcp.enable(true);
  Serial.println(F("------------------------------"));
}
void loop() {
  Serial.print("Hot Junction: ");
  Serial.println(mcp.readThermocouple());
  Serial.print("Cold Junction: ");
  Serial.println(mcp.readAmbient());
  Serial.print("ADC: ");
  Serial.print(mcp.readADC() * 2);
  Serial.println(" uV");
  delay(1000);
}

here’s the compiler output…

FQBN: Seeeduino:mbed:xiaonRF52840Sense
Using board 'xiaonRF52840Sense' from platform in folder: C:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\mbed\2.9.2
Using core 'arduino' from platform in folder: C:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\mbed\2.9.2

Detecting libraries used...
C:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\tools\arm-none-eabi-gcc\7-2017q4/bin/arm-none-eabi-g++ -c -w -g3 -nostdlib @C:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\mbed\2.9.2\variants\SEEED_XIAO_NRF52840_SENSE/defines.txt @C:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\mbed\2.9.2\variants\SEEED_XIAO_NRF52840_SENSE/cxxflags.txt -DARDUINO_ARCH_NRF52840 -mcpu=cortex-m4 -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -w -x c++ -E -CC -DARDUINO=10607 -DARDUINO_SEEED_XIAO_NRF52840_SENSE -DARDUINO_ARCH_MBED -DARDUINO_ARCH_MBED -DARDUINO_LIBRARY_DISCOVERY_PHASE=1 -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\mbed\2.9.2\cores\arduino -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\mbed\2.9.2\variants\SEEED_XIAO_NRF52840_SENSE -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\mbed\2.9.2\cores\arduino/api/deprecated -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\mbed\2.9.2\cores\arduino/api/deprecated-avr-comp -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\mbed\2.9.2\cores\arduino/mbed/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_SDK_15_0/components/nfc/t2t_lib -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\mbed\2.9.2\cores\arduino/mbed/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_SDK_15_0/components/nfc/t2t_lib/hal_t2t -iprefixC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\mbed\2.9.2\cores\arduino @C:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\mbed\2.9.2\variants\SEEED_XIAO_NRF52840_SENSE/includes.txt C:\Users\Dude\AppData\Local\Temp\arduino\sketches\BEEDD9F8BA597A0B474F43831691B1C1\sketch\sketch_mar24d.ino.cpp -o nul
Alternatives for Wire.h: [Wire]
ResolveLibrary(Wire.h)
  -> candidates: [Wire]
C:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\tools\arm-none-eabi-gcc\7-2017q4/bin/arm-none-eabi-g++ -c -w -g3 -nostdlib @C:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\mbed\2.9.2\variants\SEEED_XIAO_NRF52840_SENSE/defines.txt @C:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\mbed\2.9.2\variants\SEEED_XIAO_NRF52840_SENSE/cxxflags.txt -DARDUINO_ARCH_NRF52840 -mcpu=cortex-m4 -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -w -x c++ -E -CC -DARDUINO=10607 -DARDUINO_SEEED_XIAO_NRF52840_SENSE -DARDUINO_ARCH_MBED -DARDUINO_ARCH_MBED -DARDUINO_LIBRARY_DISCOVERY_PHASE=1 -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\mbed\2.9.2\cores\arduino -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\mbed\2.9.2\variants\SEEED_XIAO_NRF52840_SENSE -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\mbed\2.9.2\libraries\Wire -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\mbed\2.9.2\cores\arduino/api/deprecated -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\mbed\2.9.2\cores\arduino/api/deprecated-avr-comp -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\mbed\2.9.2\cores\arduino/mbed/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_SDK_15_0/components/nfc/t2t_lib -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\mbed\2.9.2\cores\arduino/mbed/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_SDK_15_0/components/nfc/t2t_lib/hal_t2t -iprefixC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\mbed\2.9.2\cores\arduino @C:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\mbed\2.9.2\variants\SEEED_XIAO_NRF52840_SENSE/includes.txt C:\Users\Dude\AppData\Local\Temp\arduino\sketches\BEEDD9F8BA597A0B474F43831691B1C1\sketch\sketch_mar24d.ino.cpp -o nul
Alternatives for Adafruit_I2CDevice.h: [Adafruit [email protected]]
ResolveLibrary(Adafruit_I2CDevice.h)
  -> candidates: [Adafruit [email protected]]
C:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\tools\arm-none-eabi-gcc\7-2017q4/bin/arm-none-eabi-g++ -c -w -g3 -nostdlib @C:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\mbed\2.9.2\variants\SEEED_XIAO_NRF52840_SENSE/defines.txt @C:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\mbed\2.9.2\variants\SEEED_XIAO_NRF52840_SENSE/cxxflags.txt -DARDUINO_ARCH_NRF52840 -mcpu=cortex-m4 -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -w -x c++ -E -CC -DARDUINO=10607 -DARDUINO_SEEED_XIAO_NRF52840_SENSE -DARDUINO_ARCH_MBED -DARDUINO_ARCH_MBED -DARDUINO_LIBRARY_DISCOVERY_PHASE=1 -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\mbed\2.9.2\cores\arduino -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\mbed\2.9.2\variants\SEEED_XIAO_NRF52840_SENSE -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\mbed\2.9.2\libraries\Wire -Id:\Arduino_projects\libraries\Adafruit_BusIO -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\mbed\2.9.2\cores\arduino/api/deprecated -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\mbed\2.9.2\cores\arduino/api/deprecated-avr-comp -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\mbed\2.9.2\cores\arduino/mbed/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_SDK_15_0/components/nfc/t2t_lib -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\mbed\2.9.2\cores\arduino/mbed/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_SDK_15_0/components/nfc/t2t_lib/hal_t2t -iprefixC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\mbed\2.9.2\cores\arduino @C:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\mbed\2.9.2\variants\SEEED_XIAO_NRF52840_SENSE/includes.txt C:\Users\Dude\AppData\Local\Temp\arduino\sketches\BEEDD9F8BA597A0B474F43831691B1C1\sketch\sketch_mar24d.ino.cpp -o nul
Alternatives for SPI.h: [SPI]
ResolveLibrary(SPI.h)
  -> candidates: [SPI]
C:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\tools\arm-none-eabi-gcc\7-2017q4/bin/arm-none-eabi-g++ -c -w -g3 -nostdlib @C:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\mbed\2.9.2\variants\SEEED_XIAO_NRF52840_SENSE/defines.txt @C:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\mbed\2.9.2\variants\SEEED_XIAO_NRF52840_SENSE/cxxflags.txt -DARDUINO_ARCH_NRF52840 -mcpu=cortex-m4 -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -w -x c++ -E -CC -DARDUINO=10607 -DARDUINO_SEEED_XIAO_NRF52840_SENSE -DARDUINO_ARCH_MBED -DARDUINO_ARCH_MBED -DARDUINO_LIBRARY_DISCOVERY_PHASE=1 -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\mbed\2.9.2\cores\arduino -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\mbed\2.9.2\variants\SEEED_XIAO_NRF52840_SENSE -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\mbed\2.9.2\libraries\Wire -Id:\Arduino_projects\libraries\Adafruit_BusIO -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\mbed\2.9.2\libraries\SPI -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\mbed\2.9.2\cores\arduino/api/deprecated -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\mbed\2.9.2\cores\arduino/api/deprecated-avr-comp -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\mbed\2.9.2\cores\arduino/mbed/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_SDK_15_0/components/nfc/t2t_lib -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\mbed\2.9.2\cores\arduino/mbed/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_SDK_15_0/components/nfc/t2t_lib/hal_t2t -iprefixC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\mbed\2.9.2\cores\arduino @C:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\mbed\2.9.2\variants\SEEED_XIAO_NRF52840_SENSE/includes.txt C:\Users\Dude\AppData\Local\Temp\arduino\sketches\BEEDD9F8BA597A0B474F43831691B1C1\sketch\sketch_mar24d.ino.cpp -o nul
Alternatives for Adafruit_MCP9600.h: [Adafruit MCP9600 [email protected]]
ResolveLibrary(Adafruit_MCP9600.h)
  -> candidates: [Adafruit MCP9600 [email protected]]
*** Brevity Edit ***
Zip created at :\Users\Dude\AppData\Local\Temp\arduino\sketches\BEEDD9F8BA597A0B474F43831691B1C1/sketch_mar24d.ino.zip
Using library Wire in folder: C:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\mbed\2.9.2\libraries\Wire (legacy)
Using library Adafruit BusIO at version 1.15.0 in folder: D:\Arduino_projects\libraries\Adafruit_BusIO 
Using library SPI in folder: C:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\mbed\2.9.2\libraries\SPI (legacy)
Using library Adafruit MCP9600 Library at version 2.0.2 in folder: D:\Arduino_projects\libraries\Adafruit_MCP9600_Library 
"C:\\Users\\Dude\\AppData\\Local\\Arduino15\\packages\\Seeeduino\\tools\\arm-none-eabi-gcc\\7-2017q4/bin/arm-none-eabi-size" -A "C:\\Users\\Dude\\AppData\\Local\\Temp\\arduino\\sketches\\BEEDD9F8BA597A0B474F43831691B1C1/sketch_mar24d.ino.elf"
Sketch uses 98496 bytes (12%) of program storage space. Maximum is 811008 bytes.
Global variables use 45960 bytes (19%) of dynamic memory, leaving 191608 bytes for local variables. Maximum is 237568 bytes.

No issues, is this the Adafruit part if so go have a look at this.


Link is Here. to code and docs btw.
HTH
GL :slight_smile: PJ

BTW this was a Xiao Nrf52840 ,Not a ESP32C3 :index_pointing_at_the_viewer:You can try the same thing…
:clown_face:Spoiler Alert it compiles too with a XiaoESP32C3 :v:

FQBN: esp32:esp32:XIAO_ESP32C3
Using board 'XIAO_ESP32C3' from platform in folder: C:\Users\Dude\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.11
Using core 'esp32' from platform in folder: C:\Users\Dude\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.11
***
Using library Wire at version 2.0.0 in folder: C:\Users\Dude\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.11\libraries\Wire 
Using library Adafruit BusIO at version 1.15.0 in folder: D:\Arduino_projects\libraries\Adafruit_BusIO 
Using library SPI at version 2.0.0 in folder: C:\Users\Dude\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.11\libraries\SPI 
Using library Adafruit MCP9600 Library at version 2.0.2 in folder: D:\Arduino_projects\libraries\Adafruit_MCP9600_Library 
"C:\\Users\\Dude\\AppData\\Local\\Arduino15\\packages\\esp32\\tools\\riscv32-esp-elf-gcc\\esp-2021r2-patch5-8.4.0/bin/riscv32-esp-elf-size" -A "C:\\Users\\Dude\\AppData\\Local\\Temp\\arduino\\sketches\\BEEDD9F8BA597A0B474F43831691B1C1/sketch_mar24d.ino.elf"
Sketch uses 267064 bytes (20%) of program storage space. Maximum is 1310720 bytes.
Global variables use 13956 bytes (4%) of dynamic memory, leaving 313724 bytes for local variables. Maximum is 327680 bytes.

LOL, I’m waiting?
GL :slight_smile: PJ :v:

You can cast the result of readADC() to a uint8_t , uint16_t , or uint32_t depending on the expected data size. Since requestFrom typically expects uint8_t or uint16_t , you can cast it to uint16_t for safety. Here’s the corrected line:

Serial.print("ADC: "); Serial.print((uint16_t)mcp.readADC() * 2); Serial.println(" uV");

Hi there,
You do realize that it was a compile environment error, not a LIB error in the end. Check the compiler output, you will see it. :v:
Modifying it will break it for the other devices. Requiring an edit or commit.
HTH
GL :slight_smile: PJ :+1:

Thanks for all the help. I now know how to properly put code into a post.

The code now compiles correctly without any changes on my end. I can’t explain this with certainty but I’d guess that a library was re-released.

In any event I’m back in business. Thanks to all involved!

mcb

1 Like

Hi there,
GREAT! :smile:
Sometimes , we just need another set of eye’s or Nudge in the right Direction…
GL :slight_smile: PJ :v:

Or silently fix something and save face ( - : It’s all good

1 Like