Hi can anyone help me with my code? I am trying to see the result value for y and this is my code. I am using the serial monitor but I am not seeing any values when I change the position of the potentiometer. Can someone point out my mistake please. I am not really good with writing codes
void setup() {}
void loop()
{
int y; //Angle Value
float x; // SLOPE
float INT; // y intercept
int val = analogRead(0);
val = map(val, 41, 1015, 0, 5); //Voltage value already MAPPED
x = 0.2042;
INT = 0.0524;
y = val * x + INT;
Serial.print(y);
}
int y = 0; //Angle Value
float x = 0.2042; // SLOPE
float INT = 0.0524; // y intercept
int val = 0;
void setup() {
Serial.begin(9600);
}
void loop()
{
val = analogRead(A0);
val2 = map(val, 41, 1015, 0, 5); //Voltage value already MAPPED
y = val2 * (x + INT);
Serial.print(y);
Serial.println();
}