ich arbeite gerade mit der Liquid Crystal Library und habe folgendes Problem:
Ich kann ja mit lcd.print("HALLO"); einen Text auf dem Display erscheinen lassen. Nun würde ich gerne den Text "Hallo" & den Wert der Variablen "Value" anzeigen lassen, habe aber keine Ahnung wie das gehen soll. Bei Visual Basic geht es so: Text1.Text="Hallo:" & Value
Nabend, entweder so oder mal wieder den guten alten
Kumpel sprintf benutzen
char Buffer[10];
int Value=13;
sprintf(Buffer,"Hallo %i",Value);
LCD.Print(Buffer);
The Streaming library gives you the option of compressing those into “insertion style” code that, if not exactly the same, is reminiscent of the concatenation above:
void setup(){
};
void loop(){
String stringOne;
stringOne = String("A long integer: ");
// adding a constant long integer to a string:
stringOne += 123456789;
Serial.println(stringOne); // prints "A long integer: 123456789"
}