Please I have this Code for my Arduino dog
but it doesn't work because I don't have convereted angle to rad for cos() operation but on end I need to get angle(after cos() operation).
const int b = 200; //Lengt
const int Pin = A0; //Pot pin
int c = 0; //Variable for Angle
int d = 0; //
int e = 0; //Final side size
void setup() {
Serial.begin(9600);
}
void loop() {
c = analogRead(Pin);//Read potval write to variable c
c = map(c, 0, 1023, 0, 180);//Map potval to Angle
c = cos(c)//Calculate Cosinus
d = b - (b * c);//200 - (200 * c)
e = sqrt(d)//Calcute √e
Serial.print(e)//Print out final side a
}
//Example:
//d = 200 − (200 * 0,6560)
//d = 200 − 131,2 = 68.8
//e = √68.8
//e = 8.29