Posts: 13

Threads: 1

Joined: Apr 2022

Reputation:

**0**
Thank you guys. I used Techstyle´s code and added the conversion using "Derived data" addon so I get the data stored correctly in Influx and don´t have to do the conversion in Grafana.

Thanks again guys for helping a noob :-)

Posts: 13

Threads: 1

Joined: Apr 2022

Reputation:

**0**
I'm not sure that formula is correct, it seems to be 180 degree wrong. Noticed when comparing to a Netatmo wind sensor.

Can you use that formula on both positive and negative radian?

Should it not be *180/pi on positive radian, and *180/pi + 360 on negative radian?

I know my lack of math knowledge shines through here but am I wrong?

If so, how can I write the conversion code to take the negative values into account?

Posts: 215

Threads: 30

Joined: Oct 2019

Reputation:

**15**
you said the output was -3.14 to +3.14. if that is the case

add 3.14 to get 0 to 6.28

the multiply by 180 --> 0 would be 0 and 6.28 would be 1130.4

then divide by PI (3.14) --> 0 would be 0 and 6.28 (1130.4) would be 360

Posts: 13

Threads: 1

Joined: Apr 2022

Reputation:

**0**
Wont that also be 180 degrees off? Since -3.14 is 180 degrees.

0 is 0 degrees true north. -3.14 is 180 degrees counterclockwise and 3.14 is 180 degrees clockwise.

In java, how can I write:

if >0 *180/pi (positive radian)

<0 *180/pi + 360 (negative radian)

If I do that I guess it should be right.