|
<< Click to Display Table of Contents >> Navigation: Diversen / Conversie > Numeric naar text |
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
int a=15;
char *b = "there";
double d = 20.55;
char buff[50]; // buff is large enough to hold the entire formatted string
sprintf(buff, "Hi %s int a = %d double d = %f\n", b, a, d);
printf(buff);
Serial.println("result: ");
Serial.println(buff);
}
void loop() {
// put your main code here, to run repeatedly:
}
Resultaat:
Hi there int a = 15 double d = 20.550000
result:
Hi there int a = 15 double d = 20.550000