I’m having a bit of trouble using the TimeAlarms library on the Web IDE. When I add the library automatically (via the “include in app” button) the program compiles fine:
// This #include statement was automatically added by the Particle IDE.
#include "TimeAlarms/TimeAlarms.h"
When I try to create my own .h and .cpp file to include the library manually, I get compile errors:
// This #include statement was automatically added by the Particle IDE.
#include "TimeAlarms.h"
(The reason why I want to include the library manually is because I need to edit the .cpp file to allow for more alarms. The default is 6 for this library and I need 8.)
I am also using these two additional libraries:
// This #include statement was automatically added by the Particle IDE.
#include "OneWire/OneWire.h"
// This #include statement was automatically added by the Particle IDE.
#include "RCSwitch/RCSwitch.h"
I’m not quite sure what I am doing wrong. The same program runs fine when compiled via the desktop IDE however I’m having a bit of trouble getting things to work properly on the web IDE. Any help/ideas would be appreciated.
I’m not quite sure I’m understanding what it is telling me but here it is:
TimeAlarms.cpp: In member function 'void AlarmClass::updateNextTrigger()':
TimeAlarms.cpp:62:48: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if( value + previousMidnight(now()) <= time)
^
TimeAlarms.cpp:73:48: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if( (value + previousSunday(now())) <= time)
^
In file included from TimeAlarms.cpp:27:0:
TimeAlarms.cpp: In member function 'AlarmID_t TimeAlarmsClass::alarmOnce(time_t, OnTick_t)':
TimeAlarms.h:20:44: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
#define SECS_PER_DAY (SECS_PER_HOUR * 24UL)
^
TimeAlarms.cpp:120:19: note: in expansion of macro 'SECS_PER_DAY'
if( value <= SECS_PER_DAY)
^
TimeAlarms.cpp: In member function 'AlarmID_t TimeAlarmsClass::alarmRepeat(time_t, OnTick_t)':
TimeAlarms.h:20:44: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
#define SECS_PER_DAY (SECS_PER_HOUR * 24UL)
^
TimeAlarms.cpp:136:18: note: in expansion of macro 'SECS_PER_DAY'
if( value <= SECS_PER_DAY)
^
TimeAlarms.cpp: In member function 'time_t TimeAlarmsClass::getNextTrigger()':
TimeAlarms.cpp:326:31: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
return nextTrigger == 0xffffffff ? 0 : nextTrigger;
^
In file included from TimeAlarms.cpp:27:0:
TimeAlarms.cpp: In member function 'AlarmID_t TimeAlarmsClass::create(time_t, OnTick_t, uint8_t, dtAlarmPeriod_t, uint8_t)':
TimeAlarms.h:23:44: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
#define SECS_PER_YEAR (SECS_PER_WEEK * 52UL)
^
TimeAlarms.cpp:332:46: note: in expansion of macro 'SECS_PER_YEAR'
if( ! (dtIsAlarm(alarmType) && now() < SECS_PER_YEAR)) // only create alarm ids if the time is at least Jan 1 1971
^
aquarium.cpp: In function 'void setup()':
aquarium.cpp:65:11: error: 'PWMCPIN' was not declared in this scope
bool increment[3]={false,false,false};
^
aquarium.cpp: In function 'void loop()':
aquarium.cpp:143:11: error: 'PWMCPIN' was not declared in this scope
^
aquarium.cpp: In function 'int setPWM(String)':
aquarium.cpp:628:17: error: 'PWMCPIN' was not declared in this scope
pwmState[0]=2; //set value to 2 for "off" position
^
make[1]: *** [../build/target/user/platform-6aquarium.o] Error 1
make: *** [user] Error 2
Error: Could not compile. Please review your code.
aquarium.cpp:2:35: fatal error: TimeAlarms/TimeAlarms.h: No such file or directory
That's the one. If you include it through the library system, you need the 'double' name: "yadayada/yadayada.h", whereas you'd need the single include if you include the files manually: "yadayada.h"
The OneWire and RCSwitch both seem fine when I added them manually instead of through the system library. The TimeAlarms seems to be giving me the trouble.
With an empty sketch, including those files manually seems to work fine. Do mind the capitalization of the file names, they might make a difference.
It might be something in your code that’s being problematic.