Hello! I'm trying to calculate an angle, knowing the lenght of two sides of a triangle. So I've used the atan function. I've download the avr-libc librairies, and I wrote this :
float n; float a; n=x/y; double; a=atan(double (n)); Serial.print(a); Serial.println("rad"); delay(1000);
Of course, x and y were declared before. Everithing seems to work during the compilation, but when I look the a value on the serial monitor. But a is always equal to 0.00 rad, whatever the values of x and y are... I've tried many things, as double; tan(double (n)); ... Also, when I want to declare a and n with double, it doesn't work...
double n; double a;
but when I want to upload the program, it wrote: "sketch_feb27a.ino: In function 'void loop()': sketch_feb27a:50: error: 'n' was not declared in this scope sketch_feb27a:51: error: 'a' was not declared in this scope" So what can I do to caculate this angle? Thank you!!! :)