I'm working with Python for an application where we need to close and open doors. The values to open and close are 0 and 1 accordingly, these are commands and can not be changed, but it can be confusing to the user to see 1 or 0 (we want to make it more user friendly since it's a beginner application). Is there a way to define 1 as close and 0 as open so when sending the command to the microcontroller but when coding we use/see open or close?
I was thinking to use a dictionary but it would be good to define them at the beginning of the program so we don't need to change it every time.
Thanks!
Can we use Enum for this case?
from enum import Enum
class DoorStatus(Enum):
OPEN = 0
CLOSE = 1
Documentation: https://docs.python.org/3/library/enum.html