depends upon the value of duration, which probably defaults to zero when you don't provide a value. Of course this results in P being zero. What do you expect?
could be clearer, but it says that cos(...) takes a float - in radians - and returns a double. There is nothing that should be assumed about taking P and putting it in double quotes. There is nothing about degrees.
I have reason with my variable,
I choose P for Phase
ang for angle
T for Period (length of 1 period in ms)
duration for input (ms)
then I put in double cause I thinking it count in degree at the moment,
the formula
P = (duration*2*Pi)/T;
the formula is correct, based
P = (duration*360*Pi)/(180*T) // this formulas convert degree to rad
Actually I have duration in setup stage
but the result still 0 because I forgot to put that in loop stage.