Hello World program for HYT temp & humidity sensor
Hello Word program for HYT temp & humidity sensor library. MCU perform polling and then sends data to PC via serial interface once a second.

Connection
Remember to use pull-up resisrors to communicate with sensor by I2C

Diff: main.cpp
- Revision:
- 0:cd8ba9e5f346
diff -r 000000000000 -r cd8ba9e5f346 main.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Wed Sep 14 15:54:13 2016 +0000
@@ -0,0 +1,34 @@
+#include "mbed.h"
+#include "HYT.h"
+
+Serial pc(USBTX, USBRX);
+Ticker timeKeeping;
+// for SLSTK3400A board
+HYT SENSOR (PD6, PD7); // sda, scl
+// for WIZwiki-W7500P board
+//HYT SENSOR (D14, D15); // sda, scl
+// for ATSAMD21-XPRO board
+//HYT SENSOR (PA08, PA09); // sda, scl
+
+
+// HYT sensor polling cycle
+void dataUpdate(void)
+{
+ SENSOR.MRCommand();
+ wait_ms(100);
+ SENSOR.DFCommand();
+}
+
+void secondsCallback(void) {
+ pc.printf("Humidity level: %.1f\r\n%", SENSOR.humidity);
+ pc.printf("Temperature level: %.1f\r\n%", SENSOR.temperature);
+ pc.printf("-------------------------------\r\n%", SENSOR.temperature);
+}
+
+int main()
+{
+ timeKeeping.attach(&secondsCallback, 1.0f);
+ while(1) {
+ dataUpdate();
+ }
+}
\ No newline at end of file
HYT-271 / HYT-221 / HYT-939 Humidity & Temperature Sensor