I am having problems compiling a file that contains Particle defined functions and variables. I copied a section of code that works perfectly fine in a code.ino file, but when I copy and paste the class definition in a .cpp file, I get the following errors:
LEDBlink.cpp: In constructor ‘LEDBlink::LEDBlink(int, unsigned int)’:
LEDBlink.cpp:26:19: error: ‘OUTPUT’ was not declared in this scope
pinMode(_Pin, OUTPUT); //Define Pin as output
^
LEDBlink.cpp:26:25: error: ‘pinMode’ was not declared in this scope
pinMode(_Pin, OUTPUT); //Define Pin as output
^
LEDBlink.cpp:27:33: error: ‘digitalWrite’ was not declared in this scope
digitalWrite(_Pin, _ledState); //LED off
^
LEDBlink.cpp:28:20: error: ‘millis’ was not declared in this scope
_time = millis(); //set initial time
^
LEDBlink.cpp: In member function ‘void LEDBlink::update()’:
LEDBlink.cpp:36:16: error: ‘millis’ was not declared in this scope
if((millis() - _time) > _delay)
^
LEDBlink.cpp:39:37: error: ‘digitalWrite’ was not declared in this scope
digitalWrite(_Pin, _ledState); //Write LED State
^
LEDBlink.cpp: In member function ‘void LEDBlink::on()’:
LEDBlink.cpp:48:33: error: ‘digitalWrite’ was not declared in this scope
digitalWrite(_Pin, _ledState);
^
LEDBlink.cpp: In member function ‘void LEDBlink::off()’:
LEDBlink.cpp:55:33: error: ‘digitalWrite’ was not declared in this scope
digitalWrite(_Pin, _ledState);
^
Any help is appreciated!