Fan

Dependencies:   DS1820 mbed

Fork of TextLCD by Simon Ford

These files are about how to make a fan which is controlled by the temperature.

Files at this revision

API Documentation at this revision

Comitter:
czr
Date:
Fri May 18 16:20:14 2018 +0000
Parent:
8:308d188a2d3a
Commit message:
Fan

Changed in this revision

DS1820.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /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
--- /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
--- /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