Arduino 简明教程
Arduino - Trigonometric Functions
您需要实际使用三角函数,比如为移动物体或角速度计算距离。Arduino 提供了传统的三角函数(sin、cos、tan、asin、acos、atan),可以将其概括为编写这些函数的原型。Math.h 包含三角函数的原型。
Trigonometric Exact Syntax
double sin(double x); //returns sine of x radians
double cos(double y); //returns cosine of y radians
double tan(double x); //returns the tangent of x radians
double acos(double x); //returns A, the angle corresponding to cos (A) = x
double asin(double x); //returns A, the angle corresponding to sin (A) = x
double atan(double x); //returns A, the angle corresponding to tan (A) = x