#include <LiquidCrystal.h>
LiquidCrystal lcd(8, 9, 4, 5, 6, 7);
int input_voltageA0;
int input_voltageA1;
int analog_valueA0;
int analog_valueA1;
int analog_voltageA0;
int analog_voltageA1;
int degAlt;
int degAzi;
float temp=0.0;
void setup()
{
Serial.begin(9600);
lcd.begin(16, 2);
lcd.print("Volts to Degrees");
delay(3000);
lcd.clear();
}
void loop()
{
analog_valueA0 = analogRead(A0);
float input_voltageA0 = (analog_valueA0 * 5.0) / 1024.0;
analog_valueA1 = analogRead(A1);
float input_voltageA1 = (analog_valueA1 * 5.0) / 1024.0;
//Conversion volts to degrees
//float degAlt = (input_voltageA0-0.0061)/0.302;
float degAzi = ((input_voltageA1 + 0.062)/0.0117);
float degAlt = ((input_voltageA0 - 0.0061)/0.0302);
if (input_voltageA0 < 0.1)
if (input_voltageA1 < 0.1)
{
float input_voltageA0;
float input_voltageA1;
float degAlt;
float degAzi;
}
lcd.clear();
Serial.print("v= ");
Serial.println(input_voltageA0);
Serial.print("v= ");
Serial.println(input_voltageA1);
//lcd.setCursor(0, 0);
lcd.print("V=");
lcd.print(input_voltageA0);
lcd.print(" Alt=");
lcd.print(degAlt);
lcd.setCursor(0, 1);
lcd.print("V=");
lcd.print(input_voltageA1);
lcd.print(" Azi=");
lcd.print(degAzi);
delay(300);
}