(SOLVED): HDC1080 Arduino port

#1
  1. My goal is:
    to read temperature and humidity from an HDC1080, which is an I2C device. Since I can’t find a mongoose library I need to write or port something. I tried writing a driver using the Mongoose I2C library, but can’t get readings out of it (likely a timing issue). There’s an Arduino driver (ClosedCube_HDC1080). So |'m trying to follow the instructions for porting it to Mongoose.

  2. My actions are:
    Following the guidance at https://mongoose-os.com/docs/mongoose-os/userguide/build.md, I’ve created library directory “arduino_closedcube_hdc1080” in deps; moved the CodeCube source in there; created “mgos_arduino_ClosedCube_HDC1080”.h/cpp/c files; added “-origin: https://github.com/mongoose-os-libs/arduino-wire” and “- name: arduino_closedcube_hdc1080” to mos.yml; and included “mgos_arduino_ClosedCube_HDC1080.h” and “Wire.h” in main.cpp

  3. The result I see is:

compile error: “error: ‘class TwoWire’ has no member named ‘readBytes’”

The compiler is choking on “arduino_closedcube_hdc1080/src/ClosedCube_HDC1080.cpp” (the original source code), and appears not to have the header file available defining “readBytes”.

  1. My expectation & question is:
    I’d expect the file to compile.

I have to say the guidance at https://mongoose-os.com/docs/mongoose-os/userguide/build.md is a little brief for my skill level, and there appear to be inconsistencies between the text and the example provided which are compounding my confusion.

May | ask for some guidance on how to configure the wrappers correctly to get this going? Many thanks

Richard

#2

Digging a little further, it looks like ClosedCube extend Wire with Stream, and that is what adds in the ‘readBytes’ member. So it looks like a library issue, not a mongoose configuration issue. I’ve patched the ClosedCube library to replace ‘readBytes’ to see if that works and will report back.

#3

All sorted. Library here: https://github.com/richardjlyon/arduino_closedcube_hdc1080

#5

Hi, Im having the same problem, also a bit new to this, can you explain what to do to fix this? And the link is locked or deleted