Hi
I am using the Wokwi emulator, so I'm not sure if it's the emulator, my electronics, my code or my understanding, but the following code and wiring start low and pulls high, which is incorrect for a Pin.PULL_DOWN configuration.
For this behaviour, shouldn't I be configuring the resistor as Pin.Pull_UP?
Wokwi project: https://wokwi.com/projects/419938862117728257
I am using the Wokwi emulator, so I'm not sure if it's the emulator, my electronics, my code or my understanding, but the following code and wiring start low and pulls high, which is incorrect for a Pin.PULL_DOWN configuration.
Code:
class Pedestrian_Button(Pin): # child class inherits the parent 'Pin' class def __init__(self, pin, debug=False): super().__init__(pin, Pin.IN, Pin.PULL_DOWN) # <--- Only works when configured as PULL_DOWN ??? self.button_state self.__debug = debug self.__pin = pin @property def button_state(self): print(self.value()) return self.value()
Wokwi project: https://wokwi.com/projects/419938862117728257
Statistics: Posted by benpaddlejones — Fri Jan 24, 2025 2:16 am