nor...">

Arduino: error: "abs" has not been declared in this area

I am working on an arduino library that needs abs () function:

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

Error: 'abs' was not declared in this area

Since it is math.halready included in cpp, I am not at all sure how to fix this problem. The new arduino 1.5.2 installation did not help.

+2
source share
1 answer

Just found a solution:

Including math.h is not required for the library. Instead, include Arduino.h by adding the following to the header file:

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

All Articles