Sometimes it is a real hassle to track down all the different arduino libraries so I have started to following list.
Custom Library Notes:
Passing a serial port to a class constructor dynamically.
#include
class SomeClass {
public:
SomeClass(HardwareSerial *serialToUse);
private:
HardwareSerial *_port;
}
SomeClass::SomeClass(HardwareSerial *serialToUse) {
// save the port in the class.
this->_port = serialToUse;
}
0 Comments