Fan
Fork of TextLCD by
These files are about how to make a fan which is controlled by the temperature.
Revision 9:9531b96fc3e5, committed 2018-05-18
- Comitter:
- czr
- Date:
- Fri May 18 16:20:14 2018 +0000
- Parent:
- 8:308d188a2d3a
- Commit message:
- Fan
Changed in this revision
diff -r 308d188a2d3a -r 9531b96fc3e5 DS1820.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DS1820.lib Fri May 18 16:20:14 2018 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/Sissors/code/DS1820/#c591209285e9
diff -r 308d188a2d3a -r 9531b96fc3e5 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri May 18 16:20:14 2018 +0000 @@ -0,0 +1,22 @@ +#include "mbed.h" +#include "TextLCD.h" +#include "DS1820.h" + +TextLCD lcd(p19,p20,p21,p22,p23,p24); +DS1820 probe(p16); +PwmOut Fan(p25); + +int main(){ + Fan.period(0.0001); + while(1){ + probe.convertTemperature(true,DS1820::all_devices); + lcd.cls(); + lcd.printf("The temperature is %.2foC ",probe.temperature()); + if(probe.temperature()>32){ + Fan = 1.0;} + else if (probe.temperature()>=29){ + Fan = 0.3;} + else { + Fan = 0.1;} + } + } \ No newline at end of file
diff -r 308d188a2d3a -r 9531b96fc3e5 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Fri May 18 16:20:14 2018 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/e1686b8d5b90 \ No newline at end of file