![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Eindprogramma met alle functies
Dependencies: DS1307 EthernetInterface TextLCD WebSocketClient mbed-rtos mbed
Fork of Hoofdprogramma by
Hoofdprogramma.cpp@5:1c493bae26fc, 2014-12-16 (annotated)
- Committer:
- R0375604
- Date:
- Tue Dec 16 20:26:57 2014 +0000
- Revision:
- 5:1c493bae26fc
- Parent:
- 4:15258c48d16f
- Child:
- 6:c95e2d561599
Servo en RGB in stappen naargelang de temp; GEEN Ethernet
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
R0375604 | 3:b2001b7e5c24 | 1 | // Pieter Essers & Bjorn Vranken GROEP5 |
R0375604 | 3:b2001b7e5c24 | 2 | // Digitale Temp Meting en aansturingen via |
R0375604 | 3:b2001b7e5c24 | 3 | // RGB LED // SERVO // RELAIS |
R0375604 | 0:f99036b05ce9 | 4 | #include "mbed.h" |
R0375604 | 0:f99036b05ce9 | 5 | #include "TextLCD.h" |
R0375604 | 3:b2001b7e5c24 | 6 | #include "ds1307.h" |
R0375604 | 0:f99036b05ce9 | 7 | |
R0375604 | 0:f99036b05ce9 | 8 | // Declaratie van de Pinnen & variabelen |
R0375604 | 0:f99036b05ce9 | 9 | AnalogIn Temp1(p20); |
R0375604 | 0:f99036b05ce9 | 10 | AnalogIn Temp2(p19); |
R0375604 | 0:f99036b05ce9 | 11 | AnalogIn Temp3(p18); |
R0375604 | 0:f99036b05ce9 | 12 | |
R0375604 | 4:15258c48d16f | 13 | DigitalIn Druk1(p15); // temp1 |
R0375604 | 4:15258c48d16f | 14 | DigitalIn Druk2(p11); // temp2 |
R0375604 | 4:15258c48d16f | 15 | DigitalIn Druk3(p14); // temp3 |
R0375604 | 4:15258c48d16f | 16 | DigitalIn Down(p13); // up |
R0375604 | 4:15258c48d16f | 17 | DigitalIn Up(p12); // down |
R0375604 | 0:f99036b05ce9 | 18 | |
R0375604 | 1:386b4ee674e3 | 19 | DigitalOut Relais(p29); // pin voor de Relais |
R0375604 | 0:f99036b05ce9 | 20 | |
R0375604 | 0:f99036b05ce9 | 21 | PwmOut Servo(p21); // servo motor |
R0375604 | 4:15258c48d16f | 22 | PwmOut R(p23); // RGB => Rood |
R0375604 | 4:15258c48d16f | 23 | PwmOut G(p24); // RGB => Groen |
R0375604 | 4:15258c48d16f | 24 | PwmOut B(p22); // RGB => Blauw |
R0375604 | 0:f99036b05ce9 | 25 | PwmOut LedB(p25); // Blauwe Led als relais Uit is (Te warm) |
R0375604 | 0:f99036b05ce9 | 26 | PwmOut LedG(p26); // Groene Led als relais Uit is (Temp GOED) |
R0375604 | 0:f99036b05ce9 | 27 | |
R0375604 | 3:b2001b7e5c24 | 28 | TextLCD lcd(p5, p6, p7, p8, p9, p10); // LCD |
R0375604 | 3:b2001b7e5c24 | 29 | DS1307 my1307(p28,p27); // start DS1307 class and give it pins for connections of the DS1307 device |
R0375604 | 0:f99036b05ce9 | 30 | |
R0375604 | 3:b2001b7e5c24 | 31 | int sec; |
R0375604 | 3:b2001b7e5c24 | 32 | int min; |
R0375604 | 3:b2001b7e5c24 | 33 | int hours; |
R0375604 | 3:b2001b7e5c24 | 34 | int day; |
R0375604 | 3:b2001b7e5c24 | 35 | int date; |
R0375604 | 3:b2001b7e5c24 | 36 | int month; |
R0375604 | 3:b2001b7e5c24 | 37 | int year; |
R0375604 | 3:b2001b7e5c24 | 38 | |
R0375604 | 3:b2001b7e5c24 | 39 | float InstelTemp1 = 21; // De Gewenste Temperatuur |
R0375604 | 3:b2001b7e5c24 | 40 | float InstelTemp2 = 21; |
R0375604 | 3:b2001b7e5c24 | 41 | float InstelTemp3 = 21; |
R0375604 | 0:f99036b05ce9 | 42 | |
R0375604 | 0:f99036b05ce9 | 43 | float temp1 = 0; |
R0375604 | 0:f99036b05ce9 | 44 | float temp2 = 0; |
R0375604 | 0:f99036b05ce9 | 45 | float temp3 = 0; |
R0375604 | 0:f99036b05ce9 | 46 | |
R0375604 | 3:b2001b7e5c24 | 47 | //int teller = 0; // om een wachtlus te maken. |
R0375604 | 3:b2001b7e5c24 | 48 | void test_rw(int test) // Test voor de RTC |
R0375604 | 3:b2001b7e5c24 | 49 | { |
R0375604 | 3:b2001b7e5c24 | 50 | } |
R0375604 | 0:f99036b05ce9 | 51 | int main() |
R0375604 | 0:f99036b05ce9 | 52 | { |
R0375604 | 3:b2001b7e5c24 | 53 | lcd.cls(); // LCD Clearen |
R0375604 | 3:b2001b7e5c24 | 54 | R.period_ms(20.0f); // 20 msecond period (50Hz) |
R0375604 | 3:b2001b7e5c24 | 55 | G.period_ms(20.0f); // 20 msecond period (50Hz) |
R0375604 | 0:f99036b05ce9 | 56 | B.period_ms(20.0f); // 20 msecond period |
R0375604 | 1:386b4ee674e3 | 57 | LedB.period_ms(20.0f); // 20 msecond period |
R0375604 | 0:f99036b05ce9 | 58 | LedG.period_ms(20.0f); // 20 msecond period |
R0375604 | 0:f99036b05ce9 | 59 | lcd.cls(); // LCD Clearen |
R0375604 | 0:f99036b05ce9 | 60 | |
R0375604 | 0:f99036b05ce9 | 61 | while(1) |
R0375604 | 0:f99036b05ce9 | 62 | { |
R0375604 | 3:b2001b7e5c24 | 63 | my1307.gettime( &sec, &min, &hours, &day, &date, &month, &year); |
R0375604 | 3:b2001b7e5c24 | 64 | |
R0375604 | 0:f99036b05ce9 | 65 | float temp1 = 0; |
R0375604 | 0:f99036b05ce9 | 66 | float temp2 = 0; |
R0375604 | 0:f99036b05ce9 | 67 | float temp3 = 0; |
R0375604 | 3:b2001b7e5c24 | 68 | //------------- De Tijd op de LCD printen ------------------------------------ |
R0375604 | 3:b2001b7e5c24 | 69 | //------------- Enkel laten zien wanneer je op drukknop drukt----------------- |
R0375604 | 3:b2001b7e5c24 | 70 | while(Up) |
R0375604 | 3:b2001b7e5c24 | 71 | { |
R0375604 | 3:b2001b7e5c24 | 72 | my1307.gettime( &sec, &min, &hours, &day, &date, &month, &year); |
R0375604 | 3:b2001b7e5c24 | 73 | wait(0.5); |
R0375604 | 3:b2001b7e5c24 | 74 | lcd.cls(); |
R0375604 | 3:b2001b7e5c24 | 75 | lcd.locate(0,0); |
R0375604 | 3:b2001b7e5c24 | 76 | lcd.printf("%d:%d:%d",hours,min,sec); |
R0375604 | 3:b2001b7e5c24 | 77 | lcd.locate(0,1); |
R0375604 | 3:b2001b7e5c24 | 78 | lcd.printf("%d/%d/%d",date,month,year); |
R0375604 | 3:b2001b7e5c24 | 79 | } |
R0375604 | 1:386b4ee674e3 | 80 | //------------- Gewenste TEMP instellen ------------------------------------ |
R0375604 | 0:f99036b05ce9 | 81 | while(Druk1) // Gewenste Temp1 Instellen |
R0375604 | 0:f99036b05ce9 | 82 | { |
R0375604 | 0:f99036b05ce9 | 83 | lcd.locate(0,0); |
R0375604 | 0:f99036b05ce9 | 84 | lcd.printf("Instel Temp1 = "); |
R0375604 | 0:f99036b05ce9 | 85 | lcd.locate(0,1); |
R0375604 | 0:f99036b05ce9 | 86 | lcd.printf("%4.1f C ",InstelTemp1); |
R0375604 | 0:f99036b05ce9 | 87 | if(Down) |
R0375604 | 0:f99036b05ce9 | 88 | { |
R0375604 | 0:f99036b05ce9 | 89 | InstelTemp1 += 0.5; |
R0375604 | 0:f99036b05ce9 | 90 | lcd.locate(0,0); |
R0375604 | 0:f99036b05ce9 | 91 | lcd.printf("Instel Temp1 = "); |
R0375604 | 0:f99036b05ce9 | 92 | lcd.locate(0,1); |
R0375604 | 0:f99036b05ce9 | 93 | lcd.printf("%4.1f C ",InstelTemp1); |
R0375604 | 0:f99036b05ce9 | 94 | wait(0.5); |
R0375604 | 0:f99036b05ce9 | 95 | } |
R0375604 | 0:f99036b05ce9 | 96 | else if(Up) |
R0375604 | 0:f99036b05ce9 | 97 | { |
R0375604 | 0:f99036b05ce9 | 98 | InstelTemp1 -= 0.5; |
R0375604 | 0:f99036b05ce9 | 99 | lcd.locate(0,0); |
R0375604 | 0:f99036b05ce9 | 100 | lcd.printf("Instel Temp1 = "); |
R0375604 | 0:f99036b05ce9 | 101 | lcd.locate(0,1); |
R0375604 | 0:f99036b05ce9 | 102 | lcd.printf("%4.1f C ",InstelTemp1); |
R0375604 | 0:f99036b05ce9 | 103 | wait(0.5); |
R0375604 | 0:f99036b05ce9 | 104 | } |
R0375604 | 0:f99036b05ce9 | 105 | } |
R0375604 | 0:f99036b05ce9 | 106 | lcd.cls(); // LCD Clearen |
R0375604 | 0:f99036b05ce9 | 107 | while(Druk2) // Gewenste Temp2 Instellen |
R0375604 | 0:f99036b05ce9 | 108 | { |
R0375604 | 0:f99036b05ce9 | 109 | lcd.locate(0,0); |
R0375604 | 0:f99036b05ce9 | 110 | lcd.printf("Instel Temp2 = "); |
R0375604 | 0:f99036b05ce9 | 111 | lcd.locate(0,1); |
R0375604 | 0:f99036b05ce9 | 112 | lcd.printf("%4.1f C ",InstelTemp2); |
R0375604 | 0:f99036b05ce9 | 113 | if(Down) |
R0375604 | 0:f99036b05ce9 | 114 | { |
R0375604 | 0:f99036b05ce9 | 115 | InstelTemp2 += 0.5; |
R0375604 | 0:f99036b05ce9 | 116 | lcd.locate(0,0); |
R0375604 | 0:f99036b05ce9 | 117 | lcd.printf("Instel Temp2 = "); |
R0375604 | 0:f99036b05ce9 | 118 | lcd.locate(0,1); |
R0375604 | 0:f99036b05ce9 | 119 | lcd.printf("%4.1f C ",InstelTemp2); |
R0375604 | 0:f99036b05ce9 | 120 | wait(0.5); |
R0375604 | 0:f99036b05ce9 | 121 | } |
R0375604 | 0:f99036b05ce9 | 122 | else if(Up) |
R0375604 | 0:f99036b05ce9 | 123 | { |
R0375604 | 0:f99036b05ce9 | 124 | InstelTemp2 -= 0.5; |
R0375604 | 0:f99036b05ce9 | 125 | lcd.locate(0,0); |
R0375604 | 0:f99036b05ce9 | 126 | lcd.printf("Instel Temp2 = "); |
R0375604 | 0:f99036b05ce9 | 127 | lcd.locate(0,1); |
R0375604 | 0:f99036b05ce9 | 128 | lcd.printf("%4.1f C ",InstelTemp2); |
R0375604 | 0:f99036b05ce9 | 129 | wait(0.5); |
R0375604 | 0:f99036b05ce9 | 130 | } |
R0375604 | 0:f99036b05ce9 | 131 | } |
R0375604 | 0:f99036b05ce9 | 132 | lcd.cls(); // LCD Clearen |
R0375604 | 0:f99036b05ce9 | 133 | while(Druk3) // Gewenste Temp3 Instellen |
R0375604 | 0:f99036b05ce9 | 134 | { |
R0375604 | 0:f99036b05ce9 | 135 | lcd.locate(0,0); |
R0375604 | 0:f99036b05ce9 | 136 | lcd.printf("Instel Temp3 = "); |
R0375604 | 0:f99036b05ce9 | 137 | lcd.locate(0,1); |
R0375604 | 0:f99036b05ce9 | 138 | lcd.printf("%4.1f C ",InstelTemp3); |
R0375604 | 0:f99036b05ce9 | 139 | if(Down) |
R0375604 | 0:f99036b05ce9 | 140 | { |
R0375604 | 0:f99036b05ce9 | 141 | InstelTemp3 += 0.5; |
R0375604 | 0:f99036b05ce9 | 142 | lcd.locate(0,0); |
R0375604 | 0:f99036b05ce9 | 143 | lcd.printf("Instel Temp3 = "); |
R0375604 | 0:f99036b05ce9 | 144 | lcd.locate(0,1); |
R0375604 | 0:f99036b05ce9 | 145 | lcd.printf("%4.1f C ",InstelTemp3); |
R0375604 | 0:f99036b05ce9 | 146 | wait(0.5); |
R0375604 | 0:f99036b05ce9 | 147 | } |
R0375604 | 0:f99036b05ce9 | 148 | else if(Up) |
R0375604 | 0:f99036b05ce9 | 149 | { |
R0375604 | 0:f99036b05ce9 | 150 | InstelTemp3 -= 0.5; |
R0375604 | 0:f99036b05ce9 | 151 | lcd.locate(0,0); |
R0375604 | 0:f99036b05ce9 | 152 | lcd.printf("Instel Temp3 = "); |
R0375604 | 0:f99036b05ce9 | 153 | lcd.locate(0,1); |
R0375604 | 0:f99036b05ce9 | 154 | lcd.printf("%4.1f C ",InstelTemp3); |
R0375604 | 0:f99036b05ce9 | 155 | wait(0.5); |
R0375604 | 0:f99036b05ce9 | 156 | } |
R0375604 | 0:f99036b05ce9 | 157 | } |
R0375604 | 3:b2001b7e5c24 | 158 | //------------------------------------------------------------------------------------ |
R0375604 | 0:f99036b05ce9 | 159 | for(int t=0; t<100; t++) // Inlezen van de Temperatuur |
R0375604 | 0:f99036b05ce9 | 160 | { |
R0375604 | 0:f99036b05ce9 | 161 | temp1 = temp1 +Temp1.read(); // Temp1 inlezen |
R0375604 | 0:f99036b05ce9 | 162 | temp2 = temp2 +Temp2.read(); // Temp2 inlezen |
R0375604 | 0:f99036b05ce9 | 163 | temp3 = temp3 +Temp3.read(); // Temp3 inlezen |
R0375604 | 0:f99036b05ce9 | 164 | } |
R0375604 | 0:f99036b05ce9 | 165 | |
R0375604 | 5:1c493bae26fc | 166 | temp1 = (temp1 *3.3) + 3; // Bewerking voor de Temp in graden te bekomen. |
R0375604 | 5:1c493bae26fc | 167 | temp2 = (temp2 *3.3) + 3; |
R0375604 | 5:1c493bae26fc | 168 | temp3 = (temp3 *3.3) + 3; |
R0375604 | 1:386b4ee674e3 | 169 | //-------------- LCD Printen---------------------------------------------------------- |
R0375604 | 0:f99036b05ce9 | 170 | lcd.locate(0,0); // De ingelezen Temperatuur op de LCD zetten |
R0375604 | 0:f99036b05ce9 | 171 | lcd.printf("Temperatuur 1 = "); |
R0375604 | 0:f99036b05ce9 | 172 | lcd.locate(0,1); |
R0375604 | 0:f99036b05ce9 | 173 | lcd.printf("%4.1f C ",temp1); |
R0375604 | 1:386b4ee674e3 | 174 | wait(1.5); |
R0375604 | 0:f99036b05ce9 | 175 | lcd.cls(); |
R0375604 | 0:f99036b05ce9 | 176 | lcd.locate(0,0); |
R0375604 | 0:f99036b05ce9 | 177 | lcd.printf("Temperatuur 2 = "); |
R0375604 | 0:f99036b05ce9 | 178 | lcd.locate(0,1); |
R0375604 | 0:f99036b05ce9 | 179 | lcd.printf("%4.1f C ",temp2); |
R0375604 | 1:386b4ee674e3 | 180 | wait(1.5); |
R0375604 | 0:f99036b05ce9 | 181 | lcd.cls(); |
R0375604 | 0:f99036b05ce9 | 182 | lcd.locate(0,0); |
R0375604 | 0:f99036b05ce9 | 183 | lcd.printf("Temperatuur 3 = "); |
R0375604 | 0:f99036b05ce9 | 184 | lcd.locate(0,1); |
R0375604 | 0:f99036b05ce9 | 185 | lcd.printf("%4.1f C ",temp3); |
R0375604 | 1:386b4ee674e3 | 186 | wait(1.5); |
R0375604 | 3:b2001b7e5c24 | 187 | //-----------// RGB => Temperatuur 1// WAARSCHUWIGS SIGNAAL-------------------------------------------------------- |
R0375604 | 5:1c493bae26fc | 188 | //------Naarmate temp verder van gewenste waarde zit een andre RGB kleur-------------- |
R0375604 | 5:1c493bae26fc | 189 | //------------------------Te warme Temp----------------------------------------------- |
R0375604 | 5:1c493bae26fc | 190 | if(InstelTemp1 + 1 < temp1 && temp1 <= InstelTemp1 + 2) |
R0375604 | 0:f99036b05ce9 | 191 | { |
R0375604 | 5:1c493bae26fc | 192 | R.write(0.50f); // 50% duty cycle Geel |
R0375604 | 5:1c493bae26fc | 193 | G.write(0.50f); // 50% duty cycle |
R0375604 | 0:f99036b05ce9 | 194 | B.write(0.00f); // 0% duty cycle |
R0375604 | 5:1c493bae26fc | 195 | } |
R0375604 | 5:1c493bae26fc | 196 | else if(InstelTemp1 + 2 < temp1 && temp1 <= InstelTemp1 + 3) |
R0375604 | 5:1c493bae26fc | 197 | { |
R0375604 | 5:1c493bae26fc | 198 | R.write(0.75f); // 50% duty cycle Oranje |
R0375604 | 5:1c493bae26fc | 199 | G.write(0.25f); // 25% duty cycle |
R0375604 | 5:1c493bae26fc | 200 | B.write(0.00f); // 0% duty cycle |
R0375604 | 5:1c493bae26fc | 201 | } |
R0375604 | 5:1c493bae26fc | 202 | else if(InstelTemp1 + 3 < temp1) |
R0375604 | 5:1c493bae26fc | 203 | { |
R0375604 | 5:1c493bae26fc | 204 | R.write(0.50f); // 50% duty cycle Rood |
R0375604 | 5:1c493bae26fc | 205 | G.write(0.00f); // 0% duty cycle |
R0375604 | 5:1c493bae26fc | 206 | B.write(0.00f); // 0% duty cycle |
R0375604 | 5:1c493bae26fc | 207 | } |
R0375604 | 5:1c493bae26fc | 208 | //---------------Te koude temp---------------------------------------------- |
R0375604 | 5:1c493bae26fc | 209 | else if(InstelTemp1 - 1 > temp1 && temp1 >= InstelTemp1 - 2) |
R0375604 | 3:b2001b7e5c24 | 210 | { |
R0375604 | 5:1c493bae26fc | 211 | R.write(0.00f); // 0% duty cycle Licht blauw |
R0375604 | 5:1c493bae26fc | 212 | G.write(0.50f); // 50% duty cycle |
R0375604 | 5:1c493bae26fc | 213 | B.write(0.50f); // 50% duty cycle |
R0375604 | 5:1c493bae26fc | 214 | } |
R0375604 | 5:1c493bae26fc | 215 | else if(InstelTemp1 - 2 > temp1 && temp1 >= InstelTemp1 - 3) |
R0375604 | 5:1c493bae26fc | 216 | { |
R0375604 | 5:1c493bae26fc | 217 | R.write(0.00f); // 0% duty cycle Paars |
R0375604 | 5:1c493bae26fc | 218 | G.write(0.25f); // 25% duty cycle |
R0375604 | 5:1c493bae26fc | 219 | B.write(0.75f); // 75% duty cycle |
R0375604 | 5:1c493bae26fc | 220 | } |
R0375604 | 5:1c493bae26fc | 221 | else if(InstelTemp1 - 4 > temp1) |
R0375604 | 5:1c493bae26fc | 222 | { |
R0375604 | 5:1c493bae26fc | 223 | R.write(0.00f); // 0% duty cycle Paars |
R0375604 | 3:b2001b7e5c24 | 224 | G.write(0.00f); // 0% duty cycle |
R0375604 | 5:1c493bae26fc | 225 | B.write(0.50f); // 50% duty cycle |
R0375604 | 5:1c493bae26fc | 226 | } |
R0375604 | 5:1c493bae26fc | 227 | //-------------Goede Temp------------------------------------------------- |
R0375604 | 0:f99036b05ce9 | 228 | else // Temp is te GOED => Groene led |
R0375604 | 0:f99036b05ce9 | 229 | { |
R0375604 | 0:f99036b05ce9 | 230 | R.write(0.00f); // 0% duty cycle |
R0375604 | 0:f99036b05ce9 | 231 | G.write(0.50f); // 50% duty cycle |
R0375604 | 0:f99036b05ce9 | 232 | B.write(0.00f); // 0% duty cycle |
R0375604 | 1:386b4ee674e3 | 233 | } |
R0375604 | 2:52f7cccebdea | 234 | //-----------// Relais => Temperatuur 2// Moet met een transistor---------------------------------- |
R0375604 | 1:386b4ee674e3 | 235 | if(temp2 > InstelTemp2 + 2) // Temp is te HOOG => Blauwe led |
R0375604 | 1:386b4ee674e3 | 236 | { |
R0375604 | 1:386b4ee674e3 | 237 | Relais = 0; // Temp is te HOOG dus moet afkoelen (Niet verwarmen) |
R0375604 | 1:386b4ee674e3 | 238 | LedB.write(0.50f); // 50% duty cycle |
R0375604 | 1:386b4ee674e3 | 239 | LedG.write(0.00f); // 0% duty cycle |
R0375604 | 1:386b4ee674e3 | 240 | |
R0375604 | 1:386b4ee674e3 | 241 | } |
R0375604 | 2:52f7cccebdea | 242 | else if (temp2 < InstelTemp2 - 2) // Temp is te LAAG => Rode led |
R0375604 | 1:386b4ee674e3 | 243 | { |
R0375604 | 1:386b4ee674e3 | 244 | Relais = 1; // Temp is te LAAG Dus verwarmen |
R0375604 | 3:b2001b7e5c24 | 245 | wait(0.5); |
R0375604 | 2:52f7cccebdea | 246 | LedB.write(0.00f); // 0% duty cycle |
R0375604 | 2:52f7cccebdea | 247 | LedG.write(0.00f); // 0% duty cycle |
R0375604 | 1:386b4ee674e3 | 248 | } |
R0375604 | 1:386b4ee674e3 | 249 | else // Temp is te GOED => Groene led |
R0375604 | 1:386b4ee674e3 | 250 | { |
R0375604 | 3:b2001b7e5c24 | 251 | Relais = 0; // Tem is GOED dus niets doen |
R0375604 | 1:386b4ee674e3 | 252 | LedB.write(0.00f); // 0% duty cycle |
R0375604 | 3:b2001b7e5c24 | 253 | LedG.write(0.50f); // 100% duty cycle |
R0375604 | 1:386b4ee674e3 | 254 | } |
R0375604 | 1:386b4ee674e3 | 255 | //-----------// Servo => Temparatur 3 // ------------------------------------------------------------ |
R0375604 | 5:1c493bae26fc | 256 | //---------------------Stappen naar rechts -> Te WARM----------------------------------------------- |
R0375604 | 5:1c493bae26fc | 257 | if(InstelTemp3 + 1 < temp3 && temp3 <= InstelTemp3 + 2) |
R0375604 | 5:1c493bae26fc | 258 | { |
R0375604 | 5:1c493bae26fc | 259 | Servo = (120 * 0.000511 + 0.026); // rechts |
R0375604 | 5:1c493bae26fc | 260 | } |
R0375604 | 5:1c493bae26fc | 261 | else if(InstelTemp3 + 2 < temp3 && temp3 <= InstelTemp3 + 3) |
R0375604 | 5:1c493bae26fc | 262 | { |
R0375604 | 5:1c493bae26fc | 263 | Servo = (140 * 0.000511 + 0.026); // rechts |
R0375604 | 5:1c493bae26fc | 264 | } |
R0375604 | 5:1c493bae26fc | 265 | else if(InstelTemp3 + 3 < temp3 && temp3 <= InstelTemp3 + 4) |
R0375604 | 5:1c493bae26fc | 266 | { |
R0375604 | 5:1c493bae26fc | 267 | Servo = (160 * 0.000511 + 0.026); // rechts |
R0375604 | 5:1c493bae26fc | 268 | } |
R0375604 | 5:1c493bae26fc | 269 | else if(InstelTemp3 + 4 < temp3) |
R0375604 | 1:386b4ee674e3 | 270 | { |
R0375604 | 1:386b4ee674e3 | 271 | Servo = (170 * 0.000511 + 0.026); // rechts |
R0375604 | 1:386b4ee674e3 | 272 | } |
R0375604 | 5:1c493bae26fc | 273 | //---------------------Stappen naar links -> Te KOUD----------------------------------------------- |
R0375604 | 5:1c493bae26fc | 274 | else if(InstelTemp3 - 1 > temp3 && temp3 >= InstelTemp3 - 2) |
R0375604 | 5:1c493bae26fc | 275 | { |
R0375604 | 5:1c493bae26fc | 276 | Servo = (80 * 0.000511 + 0.026); // links |
R0375604 | 5:1c493bae26fc | 277 | } |
R0375604 | 5:1c493bae26fc | 278 | else if(InstelTemp3 - 2 > temp3 && temp3 >= InstelTemp3 - 3) |
R0375604 | 1:386b4ee674e3 | 279 | { |
R0375604 | 5:1c493bae26fc | 280 | Servo = (60 * 0.000511 + 0.026); // links |
R0375604 | 5:1c493bae26fc | 281 | } |
R0375604 | 5:1c493bae26fc | 282 | else if(InstelTemp3 - 3 > temp3 && temp3 >= InstelTemp3 - 4) |
R0375604 | 5:1c493bae26fc | 283 | { |
R0375604 | 5:1c493bae26fc | 284 | Servo = (40 * 0.000511 + 0.026); // links |
R0375604 | 1:386b4ee674e3 | 285 | } |
R0375604 | 5:1c493bae26fc | 286 | else if(InstelTemp3 - 4 > temp3) |
R0375604 | 5:1c493bae26fc | 287 | { |
R0375604 | 5:1c493bae26fc | 288 | Servo = (7 * 0.000511 + 0.026); // links |
R0375604 | 5:1c493bae26fc | 289 | } |
R0375604 | 5:1c493bae26fc | 290 | //--------------Temp is goed------------------------------------------------------------ |
R0375604 | 1:386b4ee674e3 | 291 | else // Temp is te GOED => Servo Midden |
R0375604 | 1:386b4ee674e3 | 292 | { |
R0375604 | 1:386b4ee674e3 | 293 | Servo = (90 * 0.000511 + 0.026); // rust |
R0375604 | 1:386b4ee674e3 | 294 | } |
R0375604 | 2:52f7cccebdea | 295 | //-------------------------------------------------------------------------------------------------- |
R0375604 | 0:f99036b05ce9 | 296 | } |
R0375604 | 5:1c493bae26fc | 297 | } |