Lakes:
Can someone post how to do the same with the sprintf function?
I`m curious to see how much memory (if any) using the sprintf saves, instead of doing several serial.prints.Thanks.
If you're worried about using up RAM, you've got to see THIS library: Flash | Arduiniana
I recently wrote a 4 channel solenoid valve controller program that has an extensive user menu (LOTS of text). I ran out of memory in a "flash" (pun intended). ![]()
By using the Flash library, most of my SRAM is now unused and available.
Here's a piece of the code to show how the Flash library is used:
FLASH_STRING(menu,
"\r\n"
" Four Valve Independent Controller - Main Menu\r\n"
"\r\n"
" Please select an option\r\n"
"\r\n"
" (1) Run controller\r\n\r\n"
" (2) Configure valve timing\r\n\r\n"
" (3) Review all valve timings\r\n\r\n"
" (4) Change serial baud rate\r\n\r\n"
" (5) Display free memory (debug)\r\n\r\n"
" (6) View license information\r\n\r\n"
" Option: "
);
menu.print(Serial);
SRAM used for this code: zero!
Hope this helps......
-- Roger