2017-12-09 19:35:48 -05:00
|
|
|
//
|
|
|
|
// FILE: printString.ino
|
|
|
|
// AUTHOR: Rob Tillaart
|
2020-11-27 05:28:57 -05:00
|
|
|
// VERSION: 0.1.1
|
2017-12-09 19:35:48 -05:00
|
|
|
// PURPOSE: demo experimental
|
2020-11-27 05:28:57 -05:00
|
|
|
// URL: https://github.com/RobTillaart/PrintString
|
2017-12-09 19:35:48 -05:00
|
|
|
//
|
|
|
|
// HISTORY:
|
2020-11-27 05:28:57 -05:00
|
|
|
// 0.1.0 2017-12-09 initial version
|
|
|
|
// 0.1.1 2020-04-30 align demo with latest XMLWriter lib
|
2017-12-09 19:35:48 -05:00
|
|
|
//
|
|
|
|
|
2021-11-14 11:19:48 -05:00
|
|
|
|
2017-12-09 19:35:48 -05:00
|
|
|
#include "PrintString.h"
|
2021-01-29 06:31:58 -05:00
|
|
|
#include "XMLWriter.h" // https://github.com/RobTillaart/XMLWriter
|
2017-12-09 19:35:48 -05:00
|
|
|
|
|
|
|
PrintString ps;
|
|
|
|
XMLWriter XML(&ps);
|
|
|
|
|
2021-11-14 11:19:48 -05:00
|
|
|
|
2017-12-09 19:35:48 -05:00
|
|
|
void setup()
|
|
|
|
{
|
|
|
|
Serial.begin(115200);
|
|
|
|
Serial.println(__FILE__);
|
|
|
|
|
|
|
|
ps.println("Hello World");
|
|
|
|
ps.println(3.14159265, 4);
|
|
|
|
Serial.println(ps.getString());
|
|
|
|
|
|
|
|
ps.clear();
|
|
|
|
ps.println(3.14159265, 4);
|
|
|
|
ps.println("Hello World");
|
|
|
|
Serial.println(ps.getString());
|
|
|
|
|
|
|
|
ps.clear();
|
|
|
|
|
|
|
|
XML.header();
|
|
|
|
XML.comment("Weather in Nebraska");
|
|
|
|
XML.tagOpen("Data");
|
|
|
|
XML.writeNode("Date", "20131106");
|
|
|
|
XML.writeNode("Time", "11:42");
|
|
|
|
XML.writeNode("Temp", "23.4");
|
|
|
|
XML.writeNode("Humi", "50%");
|
|
|
|
XML.writeNode("Rain", "10mm");
|
|
|
|
XML.writeNode("Sun", "40");
|
|
|
|
XML.tagClose();
|
2020-11-27 05:28:57 -05:00
|
|
|
XML.flush();
|
2017-12-09 19:35:48 -05:00
|
|
|
|
|
|
|
Serial.println(ps.getString());
|
|
|
|
|
|
|
|
Serial.println("done...");
|
|
|
|
}
|
|
|
|
|
2021-11-14 11:19:48 -05:00
|
|
|
|
2017-12-09 19:35:48 -05:00
|
|
|
void loop()
|
|
|
|
{
|
|
|
|
}
|
2020-11-27 05:28:57 -05:00
|
|
|
|
2021-11-14 11:19:48 -05:00
|
|
|
|
2020-11-27 05:28:57 -05:00
|
|
|
// -- END OF FILE --
|
2021-11-14 11:19:48 -05:00
|
|
|
|