Hi there
I try to use the cosinus function on arduino. I took the function cos() but the return value was not correct.
Here is the code:
float x = 90;
float y = 0;
void setup() {
Serial.begin(9600);
}
void loop() {
y = cos(x);
Serial.print(y);
Serial.print(" ");
}
Trig is done in radians.
There are the degrees() and radians() macros to help with conversion.
void setup()
{
Serial.begin(115200);
Serial.print("radians to degrees ");
Serial.println(degrees(3.141592));
Serial.print("degrees to radians ");
Serial.println(radians(180));
Serial.println();
}
void loop()
{
}