sprintf.esp8266.ino
/*
* This sketch demonstrates how to scan WiFi networks.
* The API is almost the same as with the WiFi Shield library,
* the most obvious difference being the different file you need to include:
*/
#include "ESP8266WiFi.h"
void setup() {
Serial.begin(115200);
// Set WiFi to station mode and disconnect from an AP if it was previously connected
WiFi.mode(WIFI_STA);
WiFi.disconnect();
delay(100);
Serial.println("Setup done");
}
void loop() {
Serial.println("=====DONE======");
char buff[20];
String a = String(5.4);
sprintf(buff, "%s, %s %d %s", "HELLO", "WORLD", 300, (char*)a.c_str());
Serial.println(buff);
// Wait a bit before scanning again
delay(5000);
}