首页 文章

Arduino:错误:'abs'未在此范围内声明

提问于
浏览
2

我正在研究需要abs()函数的arduino库:

#include <math.h>
normTransFreq1 = abs(1.0);

错误:此范围内未声明'abs'

由于 math.h 已经包含在cpp I 'm entirely unsure how to fix this problem. A new install of arduino 1.5.2 didn' t帮助中 .

1 回答

  • 3

    刚刚找到解决方案:

    库不需要包含math.h . 相反,应该通过在头文件中添加以下内容来包含Arduino.h:

    #if ARDUINO >= 100
      #include "Arduino.h"
    #else
      #include "WProgram.h"
    #endif
    

相关问题