// X = Y2 / (1023^2/255).
// Y is ADC value, X is the result between zero and 255. (1023 is for a 8bit ADC)
int i;
float b, y;
void setup()
{
Serial.begin(115200);
}
void loop()
{
b = 0;
for(i=0;i<=19;i++)
{
b = b + analogRead(A1); // Yaw
delay(1);
}
b = b/20;
if(b>517)
y = pow(map(b,517,980,0,100),2)/(10000/7);
else
y = pow(map(b,516,52,0,100),2)/(10000/-7);
Serial.println(y);
}