hopefully this is a simple question. I have a digole OLED display attached to my Core. I need to turn it off and on again at a specific point in my loop. For now, this is pretty simple and not the question, because I can simple use digole.setScreenOn() or even digole.setScreenOff().
Now we come to the point. I want to do something like this:
if (!digole.setScreenOn()) { digole.setScreenOn(); }
Right now I am damn pretty sure this will not work. I do not want to add a counter variable and I have tried to understand the library self. But, mhm ok I don´t understand it enough to know what to do. I only want to run this piece of code if the display is set off. Here is the function that I have found in the library “DigoleSerialDisplay.cpp”:
@clyde, set up a boolean flag variable in your code that you set to “true” when you turn on the screen and “false” when you turn it off. Then test that var to decide whether you turn on or off:
boolean screenOn = true; //start up condition
if (!screenOn) { //screen is off, turn it on
digole.setScreenOn(); screenOn = true;
}
else { //screen is on, turn it off
digole.setScreenOff(); screnOn = false;
}
@clyde, which digole library are you using? It would make more sense to extend the digole library with a function that returns the screen status instead.
@clyde, timothy is no longer involved with this community and Digole has done several updates to their library since that one was published. I will clone tim’s repo, update it to include digole’s changes and add several features (like the on/off status) to the class. I will post the link to the updated repo once I’m done.
@peekay123
Thank you, thank you, but you I don´t want to waste your time on that. there are more important things out there. So please do this only when you have time left - at this moment my crude workaround will do.