Skip to main content
DK.7
Associate III
November 9, 2021
Solved

How to work with radians?

  • November 9, 2021
  • 1 reply
  • 1139 views

How to work with radians in HAL?

I include a math library

#include "math.h"

and trying to implement a formula which has radians

cleansignal = 3.0 * sin (radians (Count));

And CubeIDE gives me an error: undefined reference to` radians'

    This topic has been closed for replies.
    Best answer by TDK

    Math functions take radians as an input value. If your value is in degrees, you will need to convert it.

    Assuming "Count" is in degrees:

    cleansignal = 3.0 * sin (Count * 3.14159f / 180);

    1 reply

    TDK
    TDKBest answer
    November 9, 2021

    Math functions take radians as an input value. If your value is in degrees, you will need to convert it.

    Assuming "Count" is in degrees:

    cleansignal = 3.0 * sin (Count * 3.14159f / 180);

    "If you feel a post has answered your question, please click ""Accept as Solution""."