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: mbed
Fork of Solar by
main.cpp
00001 #include "mbed.h" 00002 #include "DHT.h" 00003 00004 RawSerial pc(USBTX, USBRX);//Serial LOG 00005 DHT dht21(p21,DHT22); //Udendørs temperatur 00006 DHT dht22(p22,DHT22); //Udendørs temperatur 00007 00008 float UdeTemp1; 00009 float UdeHym1; 00010 00011 float UdeTemp2; 00012 float UdeHym2; 00013 00014 int main() 00015 { 00016 while(1) { 00017 00018 int err=dht22.readData(); 00019 wait(2.0); 00020 if (err==0) { 00021 UdeTemp1=dht22.ReadTemperature(CELCIUS); 00022 UdeHym1=dht22.ReadHumidity(); 00023 00024 int err=dht21.readData(); 00025 wait(2.0); 00026 if (err==0) { 00027 UdeTemp2=dht21.ReadTemperature(CELCIUS); 00028 UdeHym2=dht21.ReadHumidity(); 00029 } 00030 00031 //Serial Log 00032 pc.printf("Temp:\r\n"); 00033 pc.printf("DHT22: %.2fC %.1f% \n\r",UdeTemp1,UdeHym1); 00034 pc.printf("DHT21: %.2fC %.1f% \n\r",UdeTemp2,UdeHym2); 00035 pc.printf("\n\r"); 00036 00037 wait(2.0); 00038 } 00039 } 00040 }
Generated on Mon Jul 18 2022 12:04:54 by
1.7.2
