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 "pindefs.h" 00003 #include "led_lights.h" 00004 #include "peltier.h" 00005 #include "peltier_pindefs.h" 00006 #include "TextLCD.h" 00007 #include "pumps.h" 00008 #include "pumps_pindefs.h" 00009 #include "weight.h" 00010 #include "weight_pindefs.h" 00011 #include "DHT.h" 00012 00013 DHT sensor(PTD3,SEN11301P); // Use the SEN11301P sensor 00014 00015 //Serial pc(USBTX, USBRX); // tx, rx 00016 //DigitalOut te1(PTD7); 00017 DigitalOut backlight(PTD6); 00018 float desire_temp; 00019 00020 /* 00021 AnalogIn ain(p19); 00022 DigitalOut led(LED1); 00023 00024 int main() { 00025 while (1){ 00026 if(ain > 0.3) { 00027 led = 1; 00028 } else { 00029 led = 0; 00030 } 00031 } 00032 } 00033 */ 00034 00035 00036 //TextLCD lcd(PTE29, PTE30, PTC12, PTD0, PTD5, PTA13, TextLCD::LCD20x2); // rs, e, d4-d7 ok 00037 void init (void) 00038 { 00039 //void pumps(bool pump_1,bool pump_2,bool valve_1,bool humidity_fan_1); pump1-up pump2-down 00040 pumps(false,false,false,false); 00041 00042 //void peltier(bool fan_in,bool fan_out,bool cold,bool hot,int pwm_procent); 00043 peltier(false,false,false,false,0); 00044 00045 } 00046 int main(void) 00047 { 00048 backlight=1; 00049 tempinit(); 00050 desire_temp=40; 00051 /*te1=1; 00052 te2=1;*/ 00053 //------------------------- 00054 int err; 00055 pc.printf("\r\nDHT Test program"); 00056 pc.printf("\r\n******************\r\n"); 00057 wait(1); // wait 1 second for device stable status 00058 while (1) { 00059 // myled = 1; 00060 err = sensor.readData(); 00061 if (err == 0) { 00062 pc.printf("Temperature is %4.2f C \r\n",sensor.ReadTemperature(CELCIUS)); 00063 pc.printf("Humidity is %4.2f \r\n",sensor.ReadHumidity()); 00064 if (dsen_temp_in<desire_temp) { 00065 peltier(true,true,false,true,90); 00066 } 00067 if (dsen_temp_in>=desire_temp) { 00068 peltier(true,true,false,true,0); 00069 } 00070 } else 00071 printf("\r\nErr %i \n",err); 00072 00073 wait(15); 00074 } 00075 //------------------------------ 00076 // while(1) { 00077 /* read_weight(); 00078 calc_weight(); 00079 00080 */ 00081 00082 00083 // peltier_auto(30); 00084 // led_test(); 00085 00086 // pc.printf("wait20"); 00087 /* 00088 te2=1; 00089 wait(1); 00090 te1=0; 00091 wait(10); 00092 peltier(true,true,false,false,10); 00093 te1=1; 00094 wait(1); 00095 te2=0; 00096 wait(10); 00097 peltier(true,true,false,false,10);*/ 00098 00099 //wait(1); 00100 //void peltier(bool fan_in,bool fan_out,bool cold,bool hot,int pwm_procent); 00101 /* if (dsen_temp_in<desire_temp) { 00102 peltier(true,true,false,true,90); 00103 } 00104 if (dsen_temp_in>=desire_temp) { 00105 peltier(true,true,false,true,0); 00106 } 00107 */ 00108 /* wait(10); 00109 pumps(true,false,false,false); 00110 wait(2); 00111 pumps(false,true,true,false); 00112 wait(2); 00113 pumps(false,false,false,true); 00114 wait(2); 00115 pumps(false,false,false,false); 00116 wait(20);*/ 00117 00118 // } 00119 00120 }
Generated on Thu Jul 14 2022 00:11:23 by
1.7.2