3 ms·
Looking at [0], I see a "c_str()" method. Maybe give that a shot? Serial.printf("%s", String("Hello world...").c_str()); I actually don't see a "Serial.pri
by CoastalCoder 2y ago
Looking at [0], I see a "c_str()" method. Maybe give that a shot?
Serial.printf("%s", String("Hello world...").c_str());
I actually don't see a "Serial.printf(...)" method in these docs [1], but I do see it here [2]. I'm not sure I'm looking at that right docs for your library though.
[0] https://www.arduino.cc/reference/en/language/variables/data-types/stringobject/ https://www.arduino.cc/reference/en/language/variables/data-...
[1] https://www.arduino.cc/reference/en/language/functions/communication/serial/print/ https://www.arduino.cc/reference/en/language/functions/commu...
[2] https://docs.particle.io/reference/device-os/api/serial/printf/ https://docs.particle.io/reference/device-os/api/serial/prin...
- Terr_ 2y agoJust to answer the mystery, it seems the foot-gun is that smaller String()s appear to work "by accident" due to an optimization, and I have to call a method on the String object before passing it onwards. [0] > I actually don't see a "Serial.printf(...)" method I think it's coming from the ESP32-specific libraries. Some cursory searching didn't find the spot, but it may be some magical preprocessor directive stuff. [0] https://github.com/espressif/arduino-esp32/blob/7a82915de215ec0572e0d3e10fb44674056ec885/cores/esp32/WString.h#L320:L328 https://github.com/espressif/arduino-esp32/blob/7a82915de215...