Im having a hard time combining these two codes together any help is appreciated, thanks.
int Vout = 0;
int egtPin = 2;
int egt = 0;
// include the library code:
#include <LiquidCrystal.h>
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(7, 8, 9, 10, 11, 12);
void setup()
{
lcd.begin(16, 2);
lcd.setCursor(0,0);
lcd.print("O:");
lcd.setCursor(5,0);
lcd.print((char)223);
lcd.setCursor(6,0);
lcd.print("F");
lcd.setCursor(9,0);
lcd.print("W: ");
lcd.print((char)223);
lcd.setCursor(15,0);
lcd.print("F");
lcd.setCursor(7,1);
lcd.print("EGT:");
lcd.setCursor(0,1);
lcd.print("PSI:");
}
void loop()
{
Vout = (analogRead(egtPin) * .004882814);
egt = (((Vout - 1.25) / 0.005)* 1.8) +32;//egt in F
float resistance, voltage, r_fixed, T0, T, R0, B, F, Toil, F1;
T0 = 348.15;//initial temperature for calibration
R0 = 150;//initial resistance for calibration
r_fixed = 138;//known resistance
B = 3947;//B for normalization
while(1)
{
voltage = analogRead(0)*5.0/1024;// Renormalizing from 0 to 5 volts.
resistance = voltage*r_fixed/(5.00-voltage);//find unknown resistance
T = 1/(log(resistance/r_fixed)/B+1/T0)-273.14;//find temperature from unknown ressistance
F = (T * 9 / 5 + 32);
voltage = analogRead(1)*5.0/1024;// Renormalizing from 0 to 5 volts.
resistance = voltage*r_fixed/(5.00-voltage);//find unknown resistance
Toil = 1/(log(resistance/r_fixed)/B+1/T0)-273.14;//find temperature from unknown ressistance
F1 = (Toil * 9 / 5 + 32);
lcd.setCursor(11,0);
lcd.print(F,0);
lcd.setCursor(2,0);
lcd.print(F1,0 );
lcd.setCursor(11,1);
lcd.print(egt);
delay(1000);
}
}
and
int OilPressure = 0;
#define aref_voltage 1.1
void setup()
{
analogReference(INTERNAL);
}
void loop()
{
float OilPressure = GetOilPressure(analogRead(3));
delay(1000);
}
float GetOilPressure(int RawADC)
{
float volt = RawADC * (aref_voltage/1023.0);
float bar = ((2.1271 * volt) + 5.1075 ) * volt - 0.2561; // optimized
float psi = bar * 14.7;
return psi;
}