How can I print more than one variable at a time to an LCD? For example, print(var1 . var2); or print("var1" + "var2");
The way I like to do it is to format my output using SPRINTF.
int sensor = 0;
int value = 1023; // demo values
const char *mask = "Sensor #%d value is %4d\r\n";
sprintf(buffer, mask, sensor, value);
That works a lot better than line after line of "lcd.print(firstpart), lcd.print(nextpart), lcd.print(morestuff), etc....."
Only downside is if you try to use sprintf with floating point values... the Arduino AVR libraries are stripped down to minimize code size and floating point is not supported.
You CAN either change the compiler option strings and rebuild the IDE to support floating point, or you can "patch" your "libc.a" files to put back in the floating point support, but then the resulting code ends up being about 1.5K larger.
If you are interested in using these methods, let me know and I'll give you the files you need.
-- Roger(edit to add):
Attached is a ZIP file of a new "pde.jar" file for Arduino IDE 1.0.3.
It's the same as original, except that it adds the option "Enable floating point support" in the "Preferences" dialog and saves the choice in the "preferences.txt" file as "build.floating_point=true/false".
If it's checked on (true), then the compiler option "-Wl,-u,vfscanf,-lscanf_flt,-u,vfprintf,-lprintf_flt,--gc-sections"+optRelax," is used. If it's checked off (false), the standard non-floating point "-Wl, --gc-sections"+optRelax," option is used.
The .jar file should be compatible with Windows, MAC and Linux since only the Java code was changed. If you like, please give it a try... FIRST make a backup copy of your "pde.jar" file (located in the /arduino/lib directory) by naming it to something like "pde.backup" (don't use a .jar extension!). Then unzip the attached file in the same place. The new "pde.jar" file will be extracted. If it's working, you should have a new option in your "Preferences" dialog and you should be able to turn on or off floating point support.
Note that your compiled sketches will end up about 1.5K larger if you use the floating point option.
Anyone who tries it, please let me know if it works for you (specifically I want to know if it works in Windows and MAC since I compiled it in Linux). Please feel free to email me (the icon under the avatar) and tell me if it works for you.