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.

Revision:
9:9531b96fc3e5
--- /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