Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- pin = Pin(7)
- @micropython.viper
- def touch(pin: object) -> int:
- value = 0
- for _ in range(1000):
- pin.init(mode=Pin.OUT, value=1)
- time.sleep_us(2)
- pin.init(mode=Pin.IN, pull=Pin.OPEN_DRAIN)
- value += int(pin())
- return value
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement