I wrote a wrapper class for a serial lcd screen for 4dulcd - and i want to be able to pass which serial i am using to communicate with it
I have these in my code myClass.h
#include <HardwareSerial.h>
public:
uint8_t Init(long BaudRate, HardwareSerial *serial);
private:
HardwareSerial *_HardSerial;
in myClass.cpp
uint8_t myClass::Init(long BaudRate, HardwareSerial *serial){
_HardSerial(serial);
...
}
In my sketch
#include <myClass.h>
myClass lcd;
void setup()
{
Serial1.begin(9600); // <- Error here?!
//lcd.Init(115000,&Serial1);
...
So the error is
sketch_sep17a.cpp: In function 'void setup()': sketch_sep17a:16: error: 'Serial1' was not declared in this scope
If i remove the myClass.h header than the Serial1 works... i Include it and it throws this error that makes no sense to-
I tried to include the hardwareserial in my sketch and make an instance of it but it requires all sorts of construction properties that i have no idea what they mean. And i would not even want to release my lib to do this as it is inconvenient for the normal end user.
I tried both references and pointers- same error.
Can any body help?