Control Code with I/O and ADC working

Dependencies:   MODSERIAL mbed

Committer:
jrodenburg
Date:
Mon Jan 22 20:11:52 2018 +0000
Revision:
0:a28a1035c31b
Child:
1:0182b86f9bd4
Code that has I/O working, after replacing the hotswap buffer with a dumb buffer

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jrodenburg 0:a28a1035c31b 1 // MBED SCRIPT FOR CONTROLLING THE TEMPERATURE CONTROLLED TEST FIXTURE
jrodenburg 0:a28a1035c31b 2 // AUTHOR: JUSTIN RODENBURG
jrodenburg 0:a28a1035c31b 3 // DATE: SEPTEMBER 2017
jrodenburg 0:a28a1035c31b 4
jrodenburg 0:a28a1035c31b 5 #include "mbed.h"
jrodenburg 0:a28a1035c31b 6 #include "MODSERIAL.h"
jrodenburg 0:a28a1035c31b 7 #include "MCP23008.h"
jrodenburg 0:a28a1035c31b 8 #include "LTC2487.h"
jrodenburg 0:a28a1035c31b 9
jrodenburg 0:a28a1035c31b 10 //DEFINITIVE VARIABLES
jrodenburg 0:a28a1035c31b 11 #define DEBUG 0
jrodenburg 0:a28a1035c31b 12 #define CHN_COUNT 48
jrodenburg 0:a28a1035c31b 13 #define MIN_TEMP 15
jrodenburg 0:a28a1035c31b 14 #define MAX_TEMP 60
jrodenburg 0:a28a1035c31b 15 #define HYST 0.2
jrodenburg 0:a28a1035c31b 16 #define SAMPLES 5
jrodenburg 0:a28a1035c31b 17 #define I2C_Freq 2000
jrodenburg 0:a28a1035c31b 18 #define VALVE 0
jrodenburg 0:a28a1035c31b 19 #define HEATER 1
jrodenburg 0:a28a1035c31b 20 #define STATUS_GOOD 2
jrodenburg 0:a28a1035c31b 21 #define STATUS_BAD 3
jrodenburg 0:a28a1035c31b 22 #define sizeLUT 34
jrodenburg 0:a28a1035c31b 23 #define FRONT_THERM 0
jrodenburg 0:a28a1035c31b 24 #define BACK_THERM 1
jrodenburg 0:a28a1035c31b 25 #define HEAT_FET_AMP 2
jrodenburg 0:a28a1035c31b 26 #define VALV_FET_AMP 3
jrodenburg 0:a28a1035c31b 27
jrodenburg 0:a28a1035c31b 28 //I2C AADRESS LOOK UP TABLE, CREATED IN EXCEL SHEET (COUNT, TEMP)
jrodenburg 0:a28a1035c31b 29 const struct I2C_ADDR_LUT{
jrodenburg 0:a28a1035c31b 30 int adc;
jrodenburg 0:a28a1035c31b 31 int io;
jrodenburg 0:a28a1035c31b 32 };
jrodenburg 0:a28a1035c31b 33
jrodenburg 0:a28a1035c31b 34 I2C_ADDR_LUT addrLUT[] = {
jrodenburg 0:a28a1035c31b 35 {0x23, 0x10},
jrodenburg 0:a28a1035c31b 36 {0x53, 0x60},
jrodenburg 0:a28a1035c31b 37 {0x43, 0x70},
jrodenburg 0:a28a1035c31b 38 {0x73, 0x40},
jrodenburg 0:a28a1035c31b 39 {0x63, 0x50},
jrodenburg 0:a28a1035c31b 40 {0x22, 0x11},
jrodenburg 0:a28a1035c31b 41 {0x52, 0x61},
jrodenburg 0:a28a1035c31b 42 {0x42, 0x71},
jrodenburg 0:a28a1035c31b 43 {0x72, 0x41},
jrodenburg 0:a28a1035c31b 44 {0x62, 0x51},
jrodenburg 0:a28a1035c31b 45 {0x21, 0x12},
jrodenburg 0:a28a1035c31b 46 {0x51, 0x62},
jrodenburg 0:a28a1035c31b 47 {0x41, 0x72},
jrodenburg 0:a28a1035c31b 48 {0x71, 0x42},
jrodenburg 0:a28a1035c31b 49 {0x61, 0x52},
jrodenburg 0:a28a1035c31b 50 {0x20, 0x13},
jrodenburg 0:a28a1035c31b 51 {0x50, 0x63},
jrodenburg 0:a28a1035c31b 52 {0x40, 0x73},
jrodenburg 0:a28a1035c31b 53 {0x70, 0x43},
jrodenburg 0:a28a1035c31b 54 {0x60, 0x53},
jrodenburg 0:a28a1035c31b 55 {0x26, 0x14},
jrodenburg 0:a28a1035c31b 56 {0x56, 0x64},
jrodenburg 0:a28a1035c31b 57 {0x46, 0x74},
jrodenburg 0:a28a1035c31b 58 {0x76, 0x44},
jrodenburg 0:a28a1035c31b 59 {0x66, 0x54},
jrodenburg 0:a28a1035c31b 60 {0x2C, 0x1F},
jrodenburg 0:a28a1035c31b 61 {0x5C, 0x6F},
jrodenburg 0:a28a1035c31b 62 {0x4C, 0x7F},
jrodenburg 0:a28a1035c31b 63 {0x7C, 0x4F},
jrodenburg 0:a28a1035c31b 64 {0x6C, 0x5F},
jrodenburg 0:a28a1035c31b 65 {0x2D, 0x1E},
jrodenburg 0:a28a1035c31b 66 {0x5D, 0x6E},
jrodenburg 0:a28a1035c31b 67 {0x4D, 0x7E},
jrodenburg 0:a28a1035c31b 68 {0x7D, 0x4E},
jrodenburg 0:a28a1035c31b 69 {0x6D, 0x5E},
jrodenburg 0:a28a1035c31b 70 {0x2E, 0x1D},
jrodenburg 0:a28a1035c31b 71 {0x5E, 0x6D},
jrodenburg 0:a28a1035c31b 72 {0x4E, 0x7D},
jrodenburg 0:a28a1035c31b 73 {0x7E, 0x4D},
jrodenburg 0:a28a1035c31b 74 {0x6E, 0x5D},
jrodenburg 0:a28a1035c31b 75 {0x2F, 0x1C},
jrodenburg 0:a28a1035c31b 76 {0x5F, 0x6C},
jrodenburg 0:a28a1035c31b 77 {0x4F, 0x7C},
jrodenburg 0:a28a1035c31b 78 {0x7F, 0x4C},
jrodenburg 0:a28a1035c31b 79 {0x6F, 0x5C},
jrodenburg 0:a28a1035c31b 80 {0x20, 0x1B},
jrodenburg 0:a28a1035c31b 81 {0x50, 0x6B},
jrodenburg 0:a28a1035c31b 82 {0x40, 0x7B},
jrodenburg 0:a28a1035c31b 83 };
jrodenburg 0:a28a1035c31b 84
jrodenburg 0:a28a1035c31b 85 //THERMISTOR LOOK UP TABLE, CREATED IN EXCEL SHEET (COUNT, TEMP)
jrodenburg 0:a28a1035c31b 86 const struct THERM_LUT{
jrodenburg 0:a28a1035c31b 87 int adc;
jrodenburg 0:a28a1035c31b 88 int temp;
jrodenburg 0:a28a1035c31b 89 };
jrodenburg 0:a28a1035c31b 90
jrodenburg 0:a28a1035c31b 91 THERM_LUT thermLUT[] = {
jrodenburg 0:a28a1035c31b 92 {113779,-40},
jrodenburg 0:a28a1035c31b 93 {109152,-35},
jrodenburg 0:a28a1035c31b 94 {103830,-30},
jrodenburg 0:a28a1035c31b 95 {97855,-25},
jrodenburg 0:a28a1035c31b 96 {91319,-20},
jrodenburg 0:a28a1035c31b 97 {84352,-15},
jrodenburg 0:a28a1035c31b 98 {77124,-10},
jrodenburg 0:a28a1035c31b 99 {69820,-5},
jrodenburg 0:a28a1035c31b 100 {62621,0},
jrodenburg 0:a28a1035c31b 101 {55693,5},
jrodenburg 0:a28a1035c31b 102 {49169,10},
jrodenburg 0:a28a1035c31b 103 {43144,15},
jrodenburg 0:a28a1035c31b 104 {37669,20},
jrodenburg 0:a28a1035c31b 105 {32768,25},
jrodenburg 0:a28a1035c31b 106 {28429,30},
jrodenburg 0:a28a1035c31b 107 {24622,35},
jrodenburg 0:a28a1035c31b 108 {21309,40},
jrodenburg 0:a28a1035c31b 109 {18439,45},
jrodenburg 0:a28a1035c31b 110 {15962,50},
jrodenburg 0:a28a1035c31b 111 {13831,55},
jrodenburg 0:a28a1035c31b 112 {12002,60},
jrodenburg 0:a28a1035c31b 113 {10428,65},
jrodenburg 0:a28a1035c31b 114 {9080,70},
jrodenburg 0:a28a1035c31b 115 {7919,75},
jrodenburg 0:a28a1035c31b 116 {6923,80},
jrodenburg 0:a28a1035c31b 117 {6063,85},
jrodenburg 0:a28a1035c31b 118 {5323,90},
jrodenburg 0:a28a1035c31b 119 {4685,95},
jrodenburg 0:a28a1035c31b 120 {4130,100},
jrodenburg 0:a28a1035c31b 121 {3653,105},
jrodenburg 0:a28a1035c31b 122 {3234,110},
jrodenburg 0:a28a1035c31b 123 {2876,115},
jrodenburg 0:a28a1035c31b 124 {2563,120},
jrodenburg 0:a28a1035c31b 125 {2284,125}
jrodenburg 0:a28a1035c31b 126 };
jrodenburg 0:a28a1035c31b 127
jrodenburg 0:a28a1035c31b 128 //DEFINE PINS
jrodenburg 0:a28a1035c31b 129 DigitalOut myled(LED2);
jrodenburg 0:a28a1035c31b 130
jrodenburg 0:a28a1035c31b 131 //I2C FOR MCP23008 (I/O Control)
jrodenburg 0:a28a1035c31b 132 //I2C i2c_IO(PTC9, PTC8); //sda, scl
jrodenburg 0:a28a1035c31b 133 MCP23008 io_control(PTC9, PTC8, 0x10, 2000);
jrodenburg 0:a28a1035c31b 134 MODSERIAL pc(USBTX, USBRX);
jrodenburg 0:a28a1035c31b 135
jrodenburg 0:a28a1035c31b 136 //I2C FOR LTC2487 (ADC Control)
jrodenburg 0:a28a1035c31b 137 //I2C i2c_ADC(PTC11, PTC10); //sda, scl
jrodenburg 0:a28a1035c31b 138 LTC2487 ltc2487(PTC11, PTC10, 0x23, 3000);
jrodenburg 0:a28a1035c31b 139
jrodenburg 0:a28a1035c31b 140 //GLOBAL VARIABLES
jrodenburg 0:a28a1035c31b 141 //channel status varaibles: init. to off and 0 degrees
jrodenburg 0:a28a1035c31b 142 float chTemps[CHN_COUNT] = {};
jrodenburg 0:a28a1035c31b 143 float chGoalTemps[CHN_COUNT] = {};
jrodenburg 0:a28a1035c31b 144 int chStatus[CHN_COUNT] = {};
jrodenburg 0:a28a1035c31b 145
jrodenburg 0:a28a1035c31b 146
jrodenburg 0:a28a1035c31b 147
jrodenburg 0:a28a1035c31b 148
jrodenburg 0:a28a1035c31b 149
jrodenburg 0:a28a1035c31b 150 /* Function: get_temp
jrodenburg 0:a28a1035c31b 151 **************************************************************
jrodenburg 0:a28a1035c31b 152 Description: Retrieve data from thermistor
jrodenburg 0:a28a1035c31b 153 Recieves: chn: the channel of the fixture to read temp. from
jrodenburg 0:a28a1035c31b 154 Returns: the temperature of the fixture (front or back)
jrodenburg 0:a28a1035c31b 155 */
jrodenburg 0:a28a1035c31b 156
jrodenburg 0:a28a1035c31b 157 float get_temp(int chn){
jrodenburg 0:a28a1035c31b 158 ltc2487.setAddress(addrLUT[chn].adc);
jrodenburg 0:a28a1035c31b 159
jrodenburg 0:a28a1035c31b 160 float ADC_val = (65536*1.334)/2.5;//ltc2487.readOutput(chn);
jrodenburg 0:a28a1035c31b 161
jrodenburg 0:a28a1035c31b 162 //pc.printf("ADC VAL: %f %i\r\n", ADC_val);
jrodenburg 0:a28a1035c31b 163
jrodenburg 0:a28a1035c31b 164 int i = 0;
jrodenburg 0:a28a1035c31b 165
jrodenburg 0:a28a1035c31b 166 while((i < sizeLUT) && (thermLUT[i].adc > ADC_val)){
jrodenburg 0:a28a1035c31b 167 i++;
jrodenburg 0:a28a1035c31b 168 } //find the temp. above therm temp
jrodenburg 0:a28a1035c31b 169
jrodenburg 0:a28a1035c31b 170 //Point slope formula extrapolation:
jrodenburg 0:a28a1035c31b 171 // y1 = m (x1-x0)+ y0 , y = temp. value, x = adc value
jrodenburg 0:a28a1035c31b 172 // y1 = thermLUT[i-1].temp y0 = thermLUT[i].temp
jrodenburg 0:a28a1035c31b 173 // x1 = thermLUT[i-1].adc x0 =thermLUT[i].adc
jrodenburg 0:a28a1035c31b 174 float a = float(thermLUT[i-1].temp - thermLUT[i].temp); //slope of temp between points where therm temp is between (Tmax - Tmin)
jrodenburg 0:a28a1035c31b 175 float b = float(thermLUT[i-1].adc - thermLUT[i].adc); //slope of adc between points where therm adc is between (Amax - Amin)
jrodenburg 0:a28a1035c31b 176
jrodenburg 0:a28a1035c31b 177 float m = a/b;
jrodenburg 0:a28a1035c31b 178 float y = (m*(ADC_val-thermLUT[i].adc))+thermLUT[i].temp;
jrodenburg 0:a28a1035c31b 179
jrodenburg 0:a28a1035c31b 180 return y;
jrodenburg 0:a28a1035c31b 181 }
jrodenburg 0:a28a1035c31b 182
jrodenburg 0:a28a1035c31b 183
jrodenburg 0:a28a1035c31b 184 /* Function: get_heater_current
jrodenburg 0:a28a1035c31b 185 **************************************************************
jrodenburg 0:a28a1035c31b 186 Description: Retrieve current into heater control MOSFET
jrodenburg 0:a28a1035c31b 187 Recieves: chn: the channel of the fixture to read current from
jrodenburg 0:a28a1035c31b 188 Returns: the current into the heater control MOSFET
jrodenburg 0:a28a1035c31b 189 */
jrodenburg 0:a28a1035c31b 190
jrodenburg 0:a28a1035c31b 191 float get_heater_current(int chn){
jrodenburg 0:a28a1035c31b 192
jrodenburg 0:a28a1035c31b 193 }
jrodenburg 0:a28a1035c31b 194
jrodenburg 0:a28a1035c31b 195 /* Function: get_valve_current
jrodenburg 0:a28a1035c31b 196 **************************************************************
jrodenburg 0:a28a1035c31b 197 Description: Retrieve current into valve control MOSFET
jrodenburg 0:a28a1035c31b 198 Recieves: chn: the channel of the fixture to read current from
jrodenburg 0:a28a1035c31b 199 Returns: the current into the valve control MOSFET
jrodenburg 0:a28a1035c31b 200 */
jrodenburg 0:a28a1035c31b 201
jrodenburg 0:a28a1035c31b 202 float get_valve_current(int chn){
jrodenburg 0:a28a1035c31b 203
jrodenburg 0:a28a1035c31b 204 }
jrodenburg 0:a28a1035c31b 205
jrodenburg 0:a28a1035c31b 206 /* Function: turn_valve_on
jrodenburg 0:a28a1035c31b 207 **************************************************************
jrodenburg 0:a28a1035c31b 208 Description: Turn valve on
jrodenburg 0:a28a1035c31b 209 Recieves: chn: the channel of the fixture
jrodenburg 0:a28a1035c31b 210 Returns: nothing
jrodenburg 0:a28a1035c31b 211 */
jrodenburg 0:a28a1035c31b 212
jrodenburg 0:a28a1035c31b 213 float turn_valve_on(int chn){
jrodenburg 0:a28a1035c31b 214 io_control.setAddress(addrLUT[chn].io);
jrodenburg 0:a28a1035c31b 215 io_control.init();
jrodenburg 0:a28a1035c31b 216 io_control.writeOutput(VALVE, 1);
jrodenburg 0:a28a1035c31b 217 }
jrodenburg 0:a28a1035c31b 218
jrodenburg 0:a28a1035c31b 219 /* Function: turn_valve_off
jrodenburg 0:a28a1035c31b 220 **************************************************************
jrodenburg 0:a28a1035c31b 221 Description: Turn valve off
jrodenburg 0:a28a1035c31b 222 Recieves: chn: the channel of the fixture
jrodenburg 0:a28a1035c31b 223 Returns: nothing
jrodenburg 0:a28a1035c31b 224 */
jrodenburg 0:a28a1035c31b 225
jrodenburg 0:a28a1035c31b 226 float turn_valve_off(int chn){
jrodenburg 0:a28a1035c31b 227 io_control.setAddress(addrLUT[chn].io);
jrodenburg 0:a28a1035c31b 228 io_control.init();
jrodenburg 0:a28a1035c31b 229 io_control.writeOutput(VALVE, 0);
jrodenburg 0:a28a1035c31b 230 }
jrodenburg 0:a28a1035c31b 231
jrodenburg 0:a28a1035c31b 232 /* Function: turn_heater_on
jrodenburg 0:a28a1035c31b 233 **************************************************************
jrodenburg 0:a28a1035c31b 234 Description: Turn heater on
jrodenburg 0:a28a1035c31b 235 Recieves: chn: the channel of the fixture
jrodenburg 0:a28a1035c31b 236 Returns: nothing
jrodenburg 0:a28a1035c31b 237 */
jrodenburg 0:a28a1035c31b 238
jrodenburg 0:a28a1035c31b 239 float turn_heater_on(int chn){
jrodenburg 0:a28a1035c31b 240 io_control.setAddress(addrLUT[chn].io);
jrodenburg 0:a28a1035c31b 241 io_control.init();
jrodenburg 0:a28a1035c31b 242 io_control.writeOutput(HEATER, 1);
jrodenburg 0:a28a1035c31b 243 }
jrodenburg 0:a28a1035c31b 244
jrodenburg 0:a28a1035c31b 245 /* Function: turn_heater_off
jrodenburg 0:a28a1035c31b 246 **************************************************************
jrodenburg 0:a28a1035c31b 247 Description: Turn heater off
jrodenburg 0:a28a1035c31b 248 Recieves: chn: the channel of the fixture
jrodenburg 0:a28a1035c31b 249 Returns: nothing
jrodenburg 0:a28a1035c31b 250 */
jrodenburg 0:a28a1035c31b 251
jrodenburg 0:a28a1035c31b 252 float turn_heater_off(int chn){
jrodenburg 0:a28a1035c31b 253 io_control.setAddress(addrLUT[chn].io);
jrodenburg 0:a28a1035c31b 254 io_control.init();
jrodenburg 0:a28a1035c31b 255 io_control.writeOutput(HEATER, 0);
jrodenburg 0:a28a1035c31b 256 }
jrodenburg 0:a28a1035c31b 257
jrodenburg 0:a28a1035c31b 258 /* Function: status_led
jrodenburg 0:a28a1035c31b 259 **************************************************************
jrodenburg 0:a28a1035c31b 260 Description: Turn status LED on (turns on green or red)
jrodenburg 0:a28a1035c31b 261 Recieves: chn: the channel of the fixture
jrodenburg 0:a28a1035c31b 262 status: the status of channel (good (1) or bad (0))
jrodenburg 0:a28a1035c31b 263 Returns: nothing
jrodenburg 0:a28a1035c31b 264 */
jrodenburg 0:a28a1035c31b 265
jrodenburg 0:a28a1035c31b 266 float status_led(int chn, int status){
jrodenburg 0:a28a1035c31b 267 io_control.setAddress(addrLUT[chn].io);
jrodenburg 0:a28a1035c31b 268 if(status){
jrodenburg 0:a28a1035c31b 269 io_control.writeOutput(STATUS_GOOD, 1);
jrodenburg 0:a28a1035c31b 270 io_control.writeOutput(STATUS_BAD, 0);
jrodenburg 0:a28a1035c31b 271 }
jrodenburg 0:a28a1035c31b 272 else{
jrodenburg 0:a28a1035c31b 273 io_control.writeOutput(STATUS_BAD, 1);
jrodenburg 0:a28a1035c31b 274 io_control.writeOutput(STATUS_GOOD, 1);
jrodenburg 0:a28a1035c31b 275 }
jrodenburg 0:a28a1035c31b 276 }
jrodenburg 0:a28a1035c31b 277
jrodenburg 0:a28a1035c31b 278
jrodenburg 0:a28a1035c31b 279
jrodenburg 0:a28a1035c31b 280 int main() {
jrodenburg 0:a28a1035c31b 281 //GPIO TEST
jrodenburg 0:a28a1035c31b 282 /*io_control.init();
jrodenburg 0:a28a1035c31b 283 turn_heater_on(0);
jrodenburg 0:a28a1035c31b 284 wait(1);
jrodenburg 0:a28a1035c31b 285 io_control.writeOutput(VALVE, 1);
jrodenburg 0:a28a1035c31b 286 wait(1);
jrodenburg 0:a28a1035c31b 287 io_control.writeOutput(HEATER, 1);
jrodenburg 0:a28a1035c31b 288 wait(1);
jrodenburg 0:a28a1035c31b 289 io_control.writeOutput(STATUS_GOOD, 1);
jrodenburg 0:a28a1035c31b 290 wait(1);
jrodenburg 0:a28a1035c31b 291 io_control.writeOutput(STATUS_BAD, 1);
jrodenburg 0:a28a1035c31b 292 wait(1);
jrodenburg 0:a28a1035c31b 293 io_control.writeOutput(VALVE, 0);
jrodenburg 0:a28a1035c31b 294 wait(1);
jrodenburg 0:a28a1035c31b 295 io_control.writeOutput(HEATER, 0);
jrodenburg 0:a28a1035c31b 296 wait(1);
jrodenburg 0:a28a1035c31b 297 io_control.writeOutput(STATUS_GOOD, 0);
jrodenburg 0:a28a1035c31b 298 wait(1);
jrodenburg 0:a28a1035c31b 299 io_control.writeOutput(STATUS_GOOD, 0);
jrodenburg 0:a28a1035c31b 300 wait(1);
jrodenburg 0:a28a1035c31b 301 io_control.writeOutput(STATUS_BAD, 0);
jrodenburg 0:a28a1035c31b 302 wait(1);*/
jrodenburg 0:a28a1035c31b 303
jrodenburg 0:a28a1035c31b 304
jrodenburg 0:a28a1035c31b 305 //ADCD TEST
jrodenburg 0:a28a1035c31b 306 //io_control.init();
jrodenburg 0:a28a1035c31b 307 //io_control.writeOutput(STAT_GOOD_ON, 1);
jrodenburg 0:a28a1035c31b 308 //pc.printf("HERE\r\n");
jrodenburg 0:a28a1035c31b 309 //float resulttt = ltc2487.readOutput(0);
jrodenburg 0:a28a1035c31b 310 //pc.printf("STATE: %f \r\n", get_temp(FRONT_THERM));
jrodenburg 0:a28a1035c31b 311
jrodenburg 0:a28a1035c31b 312 io_control.init();
jrodenburg 0:a28a1035c31b 313 //turn_heater_on(1);
jrodenburg 0:a28a1035c31b 314 //turn_valve_on(0);
jrodenburg 0:a28a1035c31b 315 myled = 1;
jrodenburg 0:a28a1035c31b 316 //wait(2);
jrodenburg 0:a28a1035c31b 317 //turn_heater_on(0);
jrodenburg 0:a28a1035c31b 318 //io_control.writeOutput(BACK_THERM, 1);
jrodenburg 0:a28a1035c31b 319
jrodenburg 0:a28a1035c31b 320 while(1) {
jrodenburg 0:a28a1035c31b 321 turn_heater_on(0);
jrodenburg 0:a28a1035c31b 322 turn_heater_on(1);
jrodenburg 0:a28a1035c31b 323 turn_heater_on(2);
jrodenburg 0:a28a1035c31b 324 //turn_heater_on(1);
jrodenburg 0:a28a1035c31b 325 /*turn_heater_on(1);
jrodenburg 0:a28a1035c31b 326 wait(1);
jrodenburg 0:a28a1035c31b 327 turn_valve_on(0);
jrodenburg 0:a28a1035c31b 328 wait(1);
jrodenburg 0:a28a1035c31b 329 turn_heater_off(1);
jrodenburg 0:a28a1035c31b 330 wait(1);
jrodenburg 0:a28a1035c31b 331 turn_valve_off(0);
jrodenburg 0:a28a1035c31b 332 wait(1);
jrodenburg 0:a28a1035c31b 333 myled = 1;
jrodenburg 0:a28a1035c31b 334 wait(0.2);
jrodenburg 0:a28a1035c31b 335 myled = 0;
jrodenburg 0:a28a1035c31b 336 wait(0.2);*/
jrodenburg 0:a28a1035c31b 337 }
jrodenburg 0:a28a1035c31b 338 }