I have gone through a few iterations of what to do with the mini LCDs when their corresponding button is not in use. Clearly, I want them to be blank, but how to achieve that?
My first idea was the worst one (as usual). I would have an image file for every game for every button, and if a particular button was not used in a game, then its image for that game would just be a black rectangle.
One issue with that, besides the tedium of copying the same file over and over to all the different buttons, is that even though the display is black, the backlight would still be on, and it would therefore still glow a little.
Then I realized that the method that draws the images checks for the existence of the file, as I mentioned in a previous post. So now, instead of having a bunch of files that are just black, I could only have files for games that use a particular button, and when the button is not used, no file will be found, and I could just draw a black screen when that happened.
I still would have the issue of a slight glow from the unused LCDs, but the implementation would be a lot cleaner.
Then, when I came up with the solution for lighting the LEDs in the buttons, I thought that I could power the LCD with the same pin that lights up the LED. Then I realized that that wouldn’t work, because the LCD needs to be powered up while the Arduino is looking for the image file, since those are stored on the SD card of each LCD.
Then a discussion with a coworker reminded me that there is a pin on the LCD for controlling the backlight. If I could turn the backlight off, even if the LCD has power, then my glow problem would be solved. I looked up the info about the backlight pin and found this:
- Lite – this is the PWM input for the backlight control. It is by default pulled high (backlight on) you can PWM at any frequency or pull down to turn the backlight off. Use 3-5V logic level
So I connected the Lite pin of the LCD to the A0 pin of the Arduino (which is the pin that will control the LED), and it worked like a charm. Now the LCDs next to any button not in use will be completely dark.