| Post Reply | RetroFed Forum Forum Index » learnpython |
| Author | Message | ||
|---|---|---|---|
|
bravemonkey
lemmy.ca
bravemonkey@lemmy.ca Joined: 2023-06-12 |
Hello, I've come across an unexpected issue that may be hard to diagnose due to required hardware, but here goes. I have a Raspberry Pi connected to an LCD display that I'm testing turning the screen on and off (not worrying about displaying text, I've previously written a program that uses a DHT22 sensor to display the temperature & humidity and external weather conditions using the Pirate Weather API). While trying to write a simple program just to turn the display on or off, I run into an issue. Here's the code:
What's happening that I don't understand is if power == None, the if statement will not trigger but the display will turn on. The only way I've been able to keep the display off is if I add an else statement:
This is using Python 3.10. My understanding is the else should not be needed at all. Any suggestions as to why the display might be turning on, or a better suggestion on how to handle the match statement? --EDIT-- So it turns out initializing the display is turning it on at the same time. For a community that had no activity for ~2 years before this post, I'm pleasantly surprised with the amount of responses I've gotten - you all are awesome! |
||
| 1 Original | |||
| Post Reply |
Back to top |