This code will read from both heaters every 2 seconds
Dependencies: mbed Watchdog Heater MODSERIAL FastPWM ADS8568_ADC
Diff: main.cpp
- Revision:
- 1:dffc1d53435d
- Parent:
- 0:aaad1791753c
diff -r aaad1791753c -r dffc1d53435d main.cpp --- a/main.cpp Tue Aug 06 12:46:14 2019 +0000 +++ b/main.cpp Tue Aug 06 14:14:02 2019 +0000 @@ -15,7 +15,7 @@ ------------------------------------------------------------------------------*/ #define ALL_CH 15 //value of convst bus to read all chanels simultaneosly - +#define MEASUREMENT_WAIT 5 //The wait time between reads in seconds Watchdog wd; //instantiate watchdog class @@ -102,18 +102,16 @@ guard_1.period_us(PWM_PERIOD); guard_2.period_us(PWM_PERIOD); - //while(user_1 == 0); - - //Body + + pc.printf("Number of reads, Time (ms), Current 1, Voltage 1, Resistance 1, Current 2, Voltage 2, Resistance 2"); - //if (wd.WatchdogCausedReset()) - // pc.printf("Watchdog caused reset.\r\n"); - + while(1){ heater_1.read(); heater_2.read(); - wait(2); + pc.printf("%d,%d,%d,%d,%f,%d,%d,%f\n",log_count,timer.read_ms(),heater_1.Get_i(),heater_1.Get_v(),heater_1.Get_R(),heater_2.Get_i(),heater_2.Get_v(),heater_2.Get_R()); + wait(MEASUREMENT_WAIT); }