class Button {
protected:
uint16_t x;
uint16_t y;
uint16_t w;
uint16_t h;
uint16_t button_color;
uint16_t text_color;
const char* text;
public:
Button(const char * lbl) : x(0), y(0), w(10), h(12), button_color(0), text_color(0xFFFF),text(lbl) {}
virtual void action() = 0; // Pure virtual
};
class ElectricalButton : Button {
public:
ElectricalButton(const char * lbl) : Button(lbl) {}
void action() {
Serial.print("ElectricalButton action : ");
Serial.println(text);
}
};
class MotorButton : Button {
public:
MotorButton(const char * lbl) : Button(lbl) {}
void action() {
Serial.print("MotorButton action : ");
Serial.println(text);
}
};
MotorButton leftMotorButton("left engine");
MotorButton rightMotorButton("right engine");
ElectricalButton elecButton("power");
void setup() {
Serial.begin(115200); Serial.println();
elecButton.action();
leftMotorButton.action();
rightMotorButton.action();
}
void loop() {}