I am new with coding, and I was wondering how I could run something once and define it as a constant. Here is my code:
int sensorValue1 = analogRead(A0);
int sensorValue2 = analogRead(A1);
int g0 = 9.81*9.8;
int h1 = 48;
int R = 287.06;
int a = -0.0065;
void setup() {
Serial.begin(9600);
int p1 = (1.09512*sensorValue2-22.105)*133.3225;
int t1 = (-0.08126*sensorValue1+65.6597)*274.15;
}
void loop() {
String t = "Temperature: ";
String tt = " Celsius";
String p = "Preassure: ";
String pp = " Pascal";
float celsius = -0.08126*sensorValue1+65.6597;
float kelvin = celsius*274.15;
float pascal = (1.09512*sensorValue2-22.105)*133.3225;
float height = (t1/a)*((pascal/p1)^((a*R)/g0))-1)+h1;
Serial.println(t+celsius+tt);
Serial.println(p+pascal+pp);
Serial.println(kelvin);
Serial.println( );
Serial.println(height);
delay(1000);
}