Can someone please tell me if it is possible to use a variable between <h> </h> as in Hello World!
/*Send HTML message*/
String htmlMsg = “<div style=\”color:#2f4468;\”><h1>Hello World!</h1><p>- Sent from ESP board</p></div>”;
many thanks
1 Answers
Hi.
Yes.
You should concatenate your existing string htmlMsg with the variable.
For example:
String yourVariable;
String htmlMsg = “<div style=\”color:#2f4468;\”><h1>" + YourVariable +"</h1><p>- Sent from ESP board</p></div>”;
To learn more about string concatenation, you can read this arduino guide: https://docs.arduino.cc/built-in-examples/strings/StringAdditionOperator.
Regards,
Sara