![]() ![]() Sorry if i went a little off topic at the end. Here is a really good tutorial on the sprintf function. If you are using the latest Arduino IDE, they have now added a Serial.printf() command so can do it in one line without having to fragment your Serial.println() statements every time you insert a variable. Created for developers by developers from team Browserling. There are no intrusive ads, popups or nonsense, just an ASCII to string converter. ![]() Just load your ASCII and it will automatically get converted to a string. Which is much easier when you want to log it to SD card, or send it via wifi. Free online ASCII codes to string converter. This will create a single string called buffer that contains something like: Sprintf(buffer, "Now listening at IP %s, UDP port %d\n", WiFi.localIP().toString().c_str(), localUdpPort) For example, they allow you to format the entire debug message to one string, even with variables in the middle. This has the advantage of being compatible with sprintf functions, these are old school I know but they have some advantages. rather use: WiFi.localIP().toString().c_str() ![]() If this was the case then where you had String(WiFi.localIP()) I believe what the OP was trying to do was convert the IPAddress variable to a c-string so it can be entered into a sprintf function?Ĭ-strings typically consume less memory than C++ Strings (note the capical S) and do not cause memory fragmentation like Strings do. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |