Heater for threaded program
Dependents: LEX_Threaded_Programming
Diff: Heater.cpp
- Revision:
- 10:0e16d8430d66
- Parent:
- 8:5da71ae16115
- Child:
- 11:785a0329f802
--- a/Heater.cpp Fri Jul 19 10:31:38 2019 +0000 +++ b/Heater.cpp Mon Jul 22 10:46:26 2019 +0000 @@ -27,9 +27,9 @@ void Heater::read() { //Reads R and then resets the drive back to its previous value - + timer.reset(); int i = 0; - //int drive_prev = drive; //Store previous value of drive + int drive_prev = drive; //Store previous value of drive drive = 1; wait_us(MEAS_DELAY); //Wait for ADC to settle adc.start_conversion(ALL_CH); @@ -38,8 +38,9 @@ wait_us(1); i++; } - //drive = drive_prev; + drive = drive_prev; adc.read_channels(); + //pc.printf("conversion took %d us\n", i ); //i=0; @@ -68,6 +69,10 @@ drive = 0; wait_ms(10); //Minimum duty cycle of 10% } + else + { + drive = 1; + } } }