add TwoSensorsAAR.ino

This commit is contained in:
2023-10-12 17:38:11 +01:00
parent a92a378c0b
commit 9984b3d376
2 changed files with 195 additions and 4 deletions

View File

@@ -17,16 +17,16 @@ int main()
{
float v_ref = 5, e_rc, e_comp;
float thermistor_temp, thermocouple_temp;
int thermistor_pin, thermocouple_pin; // User input for pins A0 and A1
int thermistor_val, thermocouple_val; // User input for pins A0 and A1
printf("Enter values for thermistor pin, thermocouple pin: ");
scanf("%d %d", &thermistor_pin, &thermocouple_pin);
scanf("%d %d", &thermistor_val, &thermocouple_val);
// Calculate thermistor temperature in degrees C ( Part b, i,ii,iii & v)
thermistor_temp = kelvin_to_c(resistance_to_temperature(voltage_to_resistance(adc_to_voltage(v_ref, thermistor_pin))));
thermistor_temp = kelvin_to_c(resistance_to_temperature(voltage_to_resistance(adc_to_voltage(v_ref, thermistor_val))));
// Calculate thermocouple temperature in degrees C ( Part c, i - iv)
e_rc = 1000*voltage_to_erc(adc_to_voltage(v_ref, thermistor_pin)); // convert to millivolts
e_rc = 1000*voltage_to_erc(adc_to_voltage(v_ref, thermocouple_val)); // convert to millivolts
e_comp = NISTdegCtoMilliVoltsKtype(thermistor_temp);
thermocouple_temp = NISTmilliVoltsToDegCKtype(e_rc + e_comp);