GY-63_MS5611/libraries/XMLWriter/examples/KMLWriterTest/KMLWriterTest.ino

99 lines
1.9 KiB
Arduino
Raw Normal View History

//
// FILE: KMLWriterTest.ino
// AUTHOR: Rob Tillaart
2020-05-25 03:58:04 -04:00
// VERSION: 0.1.3
// PURPOSE: simple KML writer
// DATE: 2015-05-21
2020-05-25 03:58:04 -04:00
// URL: https://github.com/RobTillaart/XMLWriter
//
#include <XMLWriter.h>
XMLWriter KML(&Serial);
char buffer[24];
2021-11-11 14:36:58 -05:00
void setup()
{
Serial.begin(115200);
2020-05-25 03:58:04 -04:00
uint32_t start = micros();
KMLTest();
2020-05-25 03:58:04 -04:00
uint32_t stop = micros();
Serial.println();
Serial.println(stop - start);
}
2021-11-11 14:36:58 -05:00
void loop()
{
}
2021-11-11 14:36:58 -05:00
void KMLTest()
{
KML.setIndentSize(2);
2015-05-23 13:45:59 -04:00
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);
2021-11-11 14:36:58 -05:00
KML.flush();
}
2021-11-11 14:36:58 -05:00
/* output
<!--
KMLWriterTest.ino
This is a demo of the XMLWriter lib for Arduino
-->
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.0">
<Document>
<Placemark>
<name>MyOffice</name>
<LookAt>
<longitude>8.853193712983327</longitude>
<latitude>53.10919982492059</latitude>
<range>500000</range>
<tilt>0</tilt>
<heading>0</heading>
</LookAt>
<Point>
<coordinates>8.853193712983327,53.10919982492059,10</coordinate>
</Point>
</Placemark>
</Document>
</kml>
*/
2020-05-25 03:58:04 -04:00
// -- END OF FILE --