Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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-...

[1] https://www.arduino.cc/reference/en/language/functions/commu...

[2] https://docs.particle.io/reference/device-os/api/serial/prin...



Just 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/7a82915de215...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: