ccc
Dependencies: HYT TextLCD mbed
Fork of HYT_example by
main.cpp
00001 #include "mbed.h" 00002 #include "HYT.h" 00003 #include "TextLCD.h" 00004 TextLCD lcd(p15, p16, p17, p18, p19, p20); 00005 Serial pc(USBTX, USBRX); 00006 Ticker timeKeeping; 00007 HYT SENSOR (p9, p10); // sda, scl 00008 // HYT sensor polling cycle 00009 void dataUpdate(void) 00010 { 00011 SENSOR.MRCommand(); 00012 wait_ms(100); 00013 SENSOR.DFCommand(); 00014 } 00015 00016 void secondsCallback(void) { 00017 pc.printf("Humidity level: %.1f\r\n%", SENSOR.humidity); 00018 pc.printf("Temperature level: %.1f\r\n%", SENSOR.temperature); 00019 pc.printf("-------------------------------\r\n%", SENSOR.temperature); 00020 lcd.locate(1,0); 00021 lcd.printf("Humidity level: %.1f\r\n%", SENSOR.humidity); 00022 } 00023 int main() 00024 { 00025 timeKeeping.attach(&secondsCallback, 1.0f); 00026 while(1) { 00027 dataUpdate(); 00028 } 00029 }
Generated on Mon Aug 1 2022 10:27:49 by 1.7.2