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.
Dependencies: DS3231 RHT03 TextLCD mbed
Fork of project by
main.cpp
00001 #include "mbed.h" 00002 #include "TextLCD.h" 00003 #include "DS3231.h" 00004 #include "RHT03.h" 00005 I2C i2c(D14,D15); 00006 TextLCD_I2C lcd(&i2c,0x4E,TextLCD::LCD16x2); 00007 DS3231 rtc(D14,D15); 00008 RHT03 rht(D13); 00009 DigitalOut p1(D3),p2(D4),p3(D5),p4(D6),p5(D7),p6(D9),p7(D10),p8(D11); 00010 00011 int main() 00012 { 00013 lcd.setMode(TextLCD::DispOn); 00014 lcd.setBacklight(TextLCD::LightOff); 00015 lcd.setCursor(TextLCD::CurOff_BlkOff); 00016 //rtc.setTime(20,58,00); 00017 //rtc.setDate(5,22,5,2015); 00018 float Temp,Hum; 00019 int dw,d,M,y,h,m,s; 00020 while(1) 00021 { 00022 rtc.readDateTime(&dw,&d,&M,&y,&h,&m,&s); 00023 rht.readData(); 00024 Temp=rht.getTemperatureC(); 00025 Hum=rht.getHumidity(); 00026 lcd.cls(); 00027 lcd.setAddress(0,0); 00028 lcd.printf("%02d/%02d/%4d",d,M,y); 00029 lcd.setAddress(0,1); 00030 lcd.printf("%02d:%02d:%02d",h,m,s); 00031 00032 wait(3); 00033 lcd.cls(); 00034 lcd.setAddress(0,0); 00035 lcd.printf("Temp:%.1f",Temp); 00036 lcd.setAddress(0,1); 00037 lcd.printf("Hum:%.1f",Hum); 00038 wait(3); 00039 00040 lcd.cls(); 00041 lcd.setAddress(0,0); 00042 lcd.printf("Port1:%3s Port2:%3s",(p1==1)?"On":"Off",(p2==1)?"On":"Off"); 00043 lcd.setAddress(0,1); 00044 lcd.printf("Port3:%3s Port4:%3s",(p3==1)?"On":"Off",(p4==1)?"On":"Off"); 00045 wait(3); 00046 00047 lcd.cls(); 00048 lcd.setAddress(0,0); 00049 lcd.printf("Port5:%3s Port6:%3s",(p5==1)?"On":"Off",(p6==1)?"On":"Off"); 00050 lcd.setAddress(0,1); 00051 lcd.printf("Port7:%3s Port8:%3s",(p7==1)?"On":"Off",(p8==1)?"On":"Off"); 00052 wait(3); 00053 } 00054 00055 00056 return 0; 00057 00058 }
Generated on Thu Jul 14 2022 20:24:16 by
1.7.2
