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.
Dependencies: DS1307 EthernetInterface TextLCD WebSocketClient mbed-rtos mbed
Fork of Hoofdprogramma by
Revision 5:1c493bae26fc, committed 2014-12-16
- Comitter:
- R0375604
- Date:
- Tue Dec 16 20:26:57 2014 +0000
- Parent:
- 4:15258c48d16f
- Child:
- 6:c95e2d561599
- Commit message:
- Servo en RGB in stappen naargelang de temp; GEEN Ethernet
Changed in this revision
| Hoofdprogramma.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/Hoofdprogramma.cpp Mon Dec 15 13:59:06 2014 +0000
+++ b/Hoofdprogramma.cpp Tue Dec 16 20:26:57 2014 +0000
@@ -163,9 +163,9 @@
temp3 = temp3 +Temp3.read(); // Temp3 inlezen
}
- temp1 *= 3.3; // Bewerking voor de Temp in graden te bekomen.
- temp2 *= 3.3;
- temp3 *= 3.3;
+ temp1 = (temp1 *3.3) + 3; // Bewerking voor de Temp in graden te bekomen.
+ temp2 = (temp2 *3.3) + 3;
+ temp3 = (temp3 *3.3) + 3;
//-------------- LCD Printen----------------------------------------------------------
lcd.locate(0,0); // De ingelezen Temperatuur op de LCD zetten
lcd.printf("Temperatuur 1 = ");
@@ -185,18 +185,46 @@
lcd.printf("%4.1f C ",temp3);
wait(1.5);
//-----------// RGB => Temperatuur 1// WAARSCHUWIGS SIGNAAL--------------------------------------------------------
- if(temp1 > InstelTemp1 + 2) // Temp is te HOOG => Rode led OPGEPAST TE WARM ------ InstelTemp1 + 1 < temp1 <= InstelTemp1 + 1,5
+//------Naarmate temp verder van gewenste waarde zit een andre RGB kleur--------------
+//------------------------Te warme Temp-----------------------------------------------
+ if(InstelTemp1 + 1 < temp1 && temp1 <= InstelTemp1 + 2)
{
- R.write(0.50f); // 50% duty cycle LED GAAT GW AAN
- G.write(0.00f); // 0% duty cycle
+ R.write(0.50f); // 50% duty cycle Geel
+ G.write(0.50f); // 50% duty cycle
B.write(0.00f); // 0% duty cycle
- }
- else if (temp1 < InstelTemp1 - 2) // Temp is te LAAG => Blauwe led LET OP TE KOUD
+ }
+ else if(InstelTemp1 + 2 < temp1 && temp1 <= InstelTemp1 + 3)
+ {
+ R.write(0.75f); // 50% duty cycle Oranje
+ G.write(0.25f); // 25% duty cycle
+ B.write(0.00f); // 0% duty cycle
+ }
+ else if(InstelTemp1 + 3 < temp1)
+ {
+ R.write(0.50f); // 50% duty cycle Rood
+ G.write(0.00f); // 0% duty cycle
+ B.write(0.00f); // 0% duty cycle
+ }
+//---------------Te koude temp----------------------------------------------
+ else if(InstelTemp1 - 1 > temp1 && temp1 >= InstelTemp1 - 2)
{
- R.write(0.00f); // 50% duty cycle
+ R.write(0.00f); // 0% duty cycle Licht blauw
+ G.write(0.50f); // 50% duty cycle
+ B.write(0.50f); // 50% duty cycle
+ }
+ else if(InstelTemp1 - 2 > temp1 && temp1 >= InstelTemp1 - 3)
+ {
+ R.write(0.00f); // 0% duty cycle Paars
+ G.write(0.25f); // 25% duty cycle
+ B.write(0.75f); // 75% duty cycle
+ }
+ else if(InstelTemp1 - 4 > temp1)
+ {
+ R.write(0.00f); // 0% duty cycle Paars
G.write(0.00f); // 0% duty cycle
- B.write(0.50f); // 0% duty cycle
- }
+ B.write(0.50f); // 50% duty cycle
+ }
+//-------------Goede Temp-------------------------------------------------
else // Temp is te GOED => Groene led
{
R.write(0.00f); // 0% duty cycle
@@ -225,24 +253,45 @@
LedG.write(0.50f); // 100% duty cycle
}
//-----------// Servo => Temparatur 3 // ------------------------------------------------------------
- if(temp3 > InstelTemp3 + 2) // Temp is te HOOG => Servo Rechts
+//---------------------Stappen naar rechts -> Te WARM-----------------------------------------------
+ if(InstelTemp3 + 1 < temp3 && temp3 <= InstelTemp3 + 2)
+ {
+ Servo = (120 * 0.000511 + 0.026); // rechts
+ }
+ else if(InstelTemp3 + 2 < temp3 && temp3 <= InstelTemp3 + 3)
+ {
+ Servo = (140 * 0.000511 + 0.026); // rechts
+ }
+ else if(InstelTemp3 + 3 < temp3 && temp3 <= InstelTemp3 + 4)
+ {
+ Servo = (160 * 0.000511 + 0.026); // rechts
+ }
+ else if(InstelTemp3 + 4 < temp3)
{
Servo = (170 * 0.000511 + 0.026); // rechts
}
- else if (temp3 < InstelTemp3 - 2) // Temp is te LAAG => Servo Links
+//---------------------Stappen naar links -> Te KOUD-----------------------------------------------
+ else if(InstelTemp3 - 1 > temp3 && temp3 >= InstelTemp3 - 2)
+ {
+ Servo = (80 * 0.000511 + 0.026); // links
+ }
+ else if(InstelTemp3 - 2 > temp3 && temp3 >= InstelTemp3 - 3)
{
- Servo = (7 * 0.000511 + 0.026); // links 7
+ Servo = (60 * 0.000511 + 0.026); // links
+ }
+ else if(InstelTemp3 - 3 > temp3 && temp3 >= InstelTemp3 - 4)
+ {
+ Servo = (40 * 0.000511 + 0.026); // links
}
+ else if(InstelTemp3 - 4 > temp3)
+ {
+ Servo = (7 * 0.000511 + 0.026); // links
+ }
+//--------------Temp is goed------------------------------------------------------------
else // Temp is te GOED => Servo Midden
{
Servo = (90 * 0.000511 + 0.026); // rust
}
//--------------------------------------------------------------------------------------------------
}
-}
-
-
-
-
-
-
+}
\ No newline at end of file
