实际上,您需要使用三角函数,就像计算移动对象的距离或角速度一样,Arduino提供了传统的三角函数(sin,cos,tan,asin,acos,atan)。
double sin(double x); //返回 x 弧度的正弦 double cos(double y); //返回 y 弧度的余弦 double tan(double x); //返回 x 弧度的正切 double acos(double x); //返回A,角度对应cos(A)=x double asin(double x); //返回A,sin (A)=x对应的角度 double atan(double x); //返回 A,对应于 tan (A)=x 的角度
double sine=sin(2); //大约 0.90929737091 double cosine=cos(2); //大约 -0.41614685058 double tangent=tan(2); //大约 -2.18503975868
祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)