2: Posts to this community must be requests for help learning python.
3: Replies in this community must be pertinent to the question OP asked.
4: No replies copy / pasted from ChatGPT or similar.
5: No advertising. No blogs/tutorials/videos/books/recruiting attempts.
This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to.
Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
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:
undefined
import board
import datetime
# I2C driver from:
# https://gist.github.com/vay3t/8b0577acfdb27a78101ed16dd78ecba1
import I2C_LCD_driver
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("state", help="'on' to turn on the screen, 'off' to turn off",type=str)
args = parser.parse_args()
mylcd = I2C_LCD_driver.lcd()
match args.state:
case "on":
power = 1
case "off":
power = 0
case _:
print("Please enter 'on' or '