EDIT: While the question below might still be legit in some way, the premise was wrong: Adafruit_PWMServoDriver does include Wire in the cpp file. It's a problem wiht my ESP8266 build environment that I misinterpreted as a missing Wire include, because the example for the Adafruit lib exlicitly includes Wire, while I did not. Sorry.
EDIT2: Issue was that the Adafruit lib falsely identified the ESP as an Arduino Due and tried to use Wire1 instead of Wire
Hi,
I am currently writing a library to deal with my constantly recurring task of controlling lights with Mqtt. Basicall, It is a set of simple child classes that dim light using different techniques (currently: analogWrite for MOSFET, or Adafruit_PWMServoDriver for dedicated PWM boards), report the status to MQTT and deal with the topics for commands and states.
Obviously, my Adafruit_PWMServoDriver-base library uses the Adafruit_PWMServoDriver class, so I included this. When debugging, I noticed that Adafruit_PWMServoDriver uses Wire.h, but does NOT include it.
Is this to allow other Includes that provide a Wire implementation? In what cases should I include other headers my code depends on and in what shouldn't I.
I guess I shouldn't when it goes close to hardware, perhaps?