As part of a simple In / Out visualisation as the first step of testing an Arduino Mega based system, I'd like to show the status of the outputs. Simplest would probbaly just be a small coloured square on screen if the output is on,and a blank square if its off. I can't see a control that does this - but as a beginner maybe I'm missing it !
Right now I have a table, which shows 0 / 1 just fine - its a bit of a clunky answer though !
Basic On/Off visualisation
And now I need to expose my poor coding skills ! This function works to toggle the relevant pin, and feeds back the checked/unchecked status just fine.
The color settings dont work though, giving error during compile - "no matching function for call to 'InterfacePanel::SetBackColor(const char*&, const __FlashStringHelper*)'"
I'd like to learn how to deal with this. I've always shied away from text and strings etc - and have limited understanding of pointers and the like....
Code: Select all
void toggle(int pin, const char* msg) {
//char msg2[25];
//strncat(msg2, msg, "CB");
digitalWrite(pin, !digitalRead(pin));
InterfacePanel MyPanel;
if (digitalRead(pin) == 1) {
MyPanel.SetCheck(msg, true); // check control
//MyPanel.SetForeColor(msg, F("Red"));
//MyPanel.SetBackColor(msg, F("Blue"));
}
else {
MyPanel.SetCheck(msg, false); // un-check control
//MyPanel.SetForeColor(msg, F("Red"));
//MyPanel.SetBackColor(msg, F("Green"));
}
I'd like to learn how to deal with this. I've always shied away from text and strings etc - and have limited understanding of pointers and the like....