diff --git a/example.xml b/example.xml
new file mode 100644
index 0000000..fedeceb
--- /dev/null
+++ b/example.xml
@@ -0,0 +1,8 @@
+
+
+ 23.45
+
+
+ 48.12
+
+
diff --git a/src/main.cpp b/src/main.cpp
index e4c21dc..2fe41a2 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -2,10 +2,13 @@
#include
Adafruit_SHT4x sht4 = Adafruit_SHT4x();
+uint32_t timestamp = millis();
+
+void sendReadingXML(uint32_t timestamp, float temperature, float humidity, const char *id);
void setup()
{
- Serial.begin(115200); // zacni seriovou komunikaci s baudrate 115200
+ Serial.begin(115200); // zacni seriovou komunikaci s baudrate 9600
Serial.println("UART OK");
pinMode(LED_BUILTIN, OUTPUT); // nastav ledku na desce jako vystup
@@ -28,17 +31,32 @@ void loop()
{
sensors_event_t humidity, temp;
- uint32_t timestamp = millis();
sht4.getEvent(&humidity, &temp); // cteni ze senzoru
- timestamp = millis() - timestamp; // ziskani delky cteni ze senzoru
+ timestamp = millis(); // pocet milisekund od spusteni procesoru
- Serial.print("temp= ");
- Serial.print(temp.temperature);
- Serial.print(" humidity=");
- Serial.println(humidity.relative_humidity);
+ sendReadingXML(timestamp, temp.temperature, humidity.relative_humidity, "SHT40");
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(250); // wait for a second
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
delay(250); // wait for a second
}
+
+void sendReadingXML(uint32_t timestamp, float temperature, float humidity, const char *id)
+{
+ Serial.print("");
+
+ Serial.print(" ");
+ Serial.print(temperature, 2);
+ Serial.println("");
+
+ Serial.print(" ");
+ Serial.print(humidity, 2);
+ Serial.println("");
+
+ Serial.println("");
+}
\ No newline at end of file