I have some sprintf commands that were working in the Arduino IDE, but after moving my program over to PlatformIO, they don’t seem to put anything into the char array. I am using an Adafruit ItsyBitsy M4, which is a Atmel SAMD 54.
It’s supposed to go to a TFT, but this shows the same issue - I get “Ping: (s)”
I did some searching on this forum, and I see a couple of posts about STM32 and setting a build flag, but they didn’t work, and I couldn’t see any flags for SAMD boards. The posts said that the sprintf was disabled on that architecture because of memory constraints. Is it disabled for SAMD boards too?
i found this method to be the one that works on all platforms meaning SAMD, STM, ESP, Pico. with the correct compiler flags it even works on AVR.
i like to get a String from my sprint func instead of creating a char buffer. its just easier and the code is cleaner. you can do Serial.print(s_printf(...)); in on line even if the Serial does not offer sprintf itself.