Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp
00001 #include "mbed.h" 00002 #include "HYT.h" 00003 00004 Serial pc(USBTX, USBRX); 00005 Ticker timeKeeping; 00006 // for SLSTK3400A board 00007 HYT SENSOR (PD6, PD7); // sda, scl 00008 // for WIZwiki-W7500P board 00009 //HYT SENSOR (D14, D15); // sda, scl 00010 // for ATSAMD21-XPRO board 00011 //HYT SENSOR (PA08, PA09); // sda, scl 00012 00013 00014 // HYT sensor polling cycle 00015 void dataUpdate(void) 00016 { 00017 SENSOR.MRCommand(); 00018 wait_ms(100); 00019 SENSOR.DFCommand(); 00020 } 00021 00022 void secondsCallback(void) { 00023 pc.printf("Humidity level: %.1f\r\n%", SENSOR.humidity); 00024 pc.printf("Temperature level: %.1f\r\n%", SENSOR.temperature); 00025 pc.printf("-------------------------------\r\n%", SENSOR.temperature); 00026 } 00027 00028 int main() 00029 { 00030 timeKeeping.attach(&secondsCallback, 1.0f); 00031 while(1) { 00032 dataUpdate(); 00033 } 00034 }
Generated on Tue Jul 26 2022 08:38:32 by
1.7.2
HYT-271 / HYT-221 / HYT-939 Humidity & Temperature Sensor