Alles wat we gepland hadden zit in het programma.

Dependencies:   DS1307 EthernetInterface TextLCD WebSocketClient mbed-rtos mbed

Fork of Hoofdprogramma by Bjorn Vranken

Files at this revision

API Documentation at this revision

Comitter:
R0375604
Date:
Thu Nov 27 10:37:28 2014 +0000
Parent:
0:f99036b05ce9
Child:
2:52f7cccebdea
Commit message:
Hoofdprogramma Versie 2

Changed in this revision

Hoofdprogramma.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/Hoofdprogramma.cpp	Thu Nov 27 10:07:39 2014 +0000
+++ b/Hoofdprogramma.cpp	Thu Nov 27 10:37:28 2014 +0000
@@ -12,7 +12,7 @@
 DigitalIn Down(p14); // up
 DigitalIn Up(p15); // down
 
-DigtalOut Relais(p29); // pin voor de Relais
+DigitalOut Relais(p29); // pin voor de Relais
 
 PwmOut Servo(p21); // servo motor
 PwmOut R(p22); // RGB => Rood
@@ -36,7 +36,7 @@
     R.period_ms(20.0f);  // 20 msecond period
     G.period_ms(20.0f);  // 20 msecond period
     B.period_ms(20.0f);  // 20 msecond period
-    LedR.period_ms(20.0f);  // 20 msecond period
+    LedB.period_ms(20.0f);  // 20 msecond period
     LedG.period_ms(20.0f);  // 20 msecond period
     
     lcd.cls(); // LCD Clearen
@@ -46,7 +46,7 @@
         float temp1 = 0;
         float temp2 = 0;
         float temp3 = 0;
-        
+ //------------- Gewenste TEMP instellen ------------------------------------       
         while(Druk1) // Gewenste Temp1 Instellen
         {
             lcd.locate(0,0);
@@ -124,8 +124,8 @@
                 wait(0.5);           
             }
         }
-        lcd.cls(); // LCD Clearen
-        
+ //------------------------------------------------------------------------------------ 
+        lcd.cls(); // LCD Clearen      
         for(int t=0; t<100; t++) // Inlezen van de Temperatuur
         {
             temp1 = temp1 +Temp1.read(); // Temp1 inlezen
@@ -136,45 +136,25 @@
         temp1 = (temp1*3.3) - 3; // Bewerking voor de Temp in graden te bekomen.
         temp2 *= 3.3;
         temp3 *= 3.3;
-        
+//-------------- LCD Printen----------------------------------------------------------       
         lcd.locate(0,0); // De ingelezen Temperatuur op de LCD zetten
         lcd.printf("Temperatuur 1 = ");
         lcd.locate(0,1);
         lcd.printf("%4.1f C ",temp1); 
-        wait(2);
+        wait(1.5);
         lcd.cls();
         lcd.locate(0,0);
         lcd.printf("Temperatuur 2 = ");
         lcd.locate(0,1);
         lcd.printf("%4.1f C ",temp2); 
-        wait(0.5);
+        wait(1.5);
         lcd.cls();
         lcd.locate(0,0);
         lcd.printf("Temperatuur 3 = ");
         lcd.locate(0,1);
         lcd.printf("%4.1f C ",temp3); 
-        wait(0.5);
-        
-        // Relais
-        if(temp1 > InstelTemp1 + 2) // Temp is te HOOG => Blauwe led
-        {
-            Relais = 0; // Temp is te HOOG dus moet afkoelen (Niet verwarmen)
-            LedB.write(0.50f);  // 50% duty cycle  
-            LedG.write(0.00f);  // 0% duty cycle
-            
-        }
-        else if (temp1 < InstelTemp1 - 2) // Temp is te LAAG => Blauwe led
-        {
-            Relais = 1; // Temp is te LAAG Dus verwarmen
-        }
-        else // Temp is te GOED => Groene led
-         {
-            Relais = 0; // Tem is GOED dus niets doen
-            LedB.write(0.00f);  // 0% duty cycle  
-            LedG.write(0.50f);  // 50% duty cycle
-        }  
-        
-        // RGB
+        wait(1.5);
+//-----------// RGB => Temperatuur 1// ------------------------------------------------------------ 
         if(temp1 > InstelTemp1 + 2) // Temp is te HOOG => Blauwe led
         {
             R.write(0.00f);  // 0% duty cycle  
@@ -192,7 +172,42 @@
             R.write(0.00f);  // 0% duty cycle  
             G.write(0.50f);  // 50% duty cycle
             B.write(0.00f);  // 0% duty cycle
-        }               
+        }
+//-----------// Relais => Temperatuur 2// ------------------------------------------------------------  
+        if(temp2 > InstelTemp2 + 2) // Temp is te HOOG => Blauwe led
+        {
+            Relais = 0; // Temp is te HOOG dus moet afkoelen (Niet verwarmen)
+            LedB.write(0.50f);  // 50% duty cycle  
+            LedG.write(0.00f);  // 0% duty cycle
+            
+        }
+        else if (temp2 < InstelTemp2 - 2) // Temp is te LAAG => Blauwe led
+        {
+            Relais = 1; // Temp is te LAAG Dus verwarmen
+        }
+        else // Temp is te GOED => Groene led
+        {
+            Relais = 0; // Tem is GOED dus niets doen
+            LedB.write(0.00f);  // 0% duty cycle  
+            LedG.write(0.50f);  // 50% duty cycle
+        }    
+//-----------// Servo => Temparatur 3 // ------------------------------------------------------------ 
+        if(temp3 > InstelTemp3 + 2) // Temp is te HOOG => Servo Rechts
+        {
+            Servo = (170 * 0.000511 + 0.026); // rechts
+            wait(2);
+        }
+        else if (temp3 < InstelTemp3 - 2) // Temp is te LAAG => Servo Links
+        {
+            Servo = (7 * 0.000511 + 0.026); // links 7
+            wait(2);
+        }
+        else // Temp is te GOED => Servo Midden
+        {
+            Servo = (90 * 0.000511 + 0.026); // rust
+            wait(2);
+        }
+//------------------------------------------------------------------------------           
     }
 }