May 15, 2021 Arduino
You need to use triangular geometry to calculate the distance or ad angle velocity of moving objects. /b10> Arduino provides traditional triangular functions (sin, cos, tan, asin, acos, atan), which can be summarized by writing their prototypes. /b11> Math.h contains a prototype of the triangular function.
double sin(double x); //返回x的正弦值 double cos(double y); //返回y的余弦值 double tan(double x); //返回x的正切值 double acos(double x); //返回x的反余弦数 double asin(double x); //返回x的反正弦数 double atan(double x); //返回x的反正切数
double sine = sin(2); // 大约 0.90929737091
double cosine = cos(2); // 大约 -0.41614685058
double tangent = tan(2); // 大约 -2.18503975868