// // FILE: KMLWriterTest.ino // AUTHOR: Rob Tillaart // PURPOSE: simple KML writer // DATE: 2015-05-21 // URL: https://github.com/RobTillaart/XMLWriter #include XMLWriter KML(&Serial); char buffer[24]; void setup() { Serial.begin(115200); uint32_t start = micros(); KMLTest(); uint32_t stop = micros(); Serial.println(); Serial.println(stop - start); } void loop() { } void KMLTest() { KML.setIndentSize(2); KML.header(); KML.comment("KMLWriterTest.ino\nThis is a demo of the XMLWriter lib for Arduino", MULTILINE); // == true (default == false) KML.tagStart("kml"); KML.tagField("xmlns", "http://earth.google.com/kml/2.0"); KML.tagEnd(NEWLINE, NOSLASH); KML.tagOpen("Document"); KML.tagOpen("Placemark"); KML.writeNode("name", "MyOffice"); // should be a function KML.tagOpen("LookAt"); KML.writeNode("longitude", "8.853193712983327"); KML.writeNode("latitude", "53.10919982492059"); KML.writeNode("range", "500000"); KML.writeNode("tilt", "0"); KML.writeNode("heading", "0"); KML.tagClose(); // should be a function KML.tagOpen("Point"); KML.writeNode("coordinates", "8.853193712983327,53.10919982492059,10"); KML.tagClose(); KML.tagClose(); // Placemark KML.tagClose(); // Document KML.tagStart("/kml"); KML.tagEnd(NEWLINE, NOSLASH); KML.flush(); } /* output MyOffice 8.853193712983327 53.10919982492059 500000 0 0 8.853193712983327,53.10919982492059,10 */ // -- END OF FILE --