Skip to content

Instantly share code, notes, and snippets.

@ahl
Last active December 30, 2019 17:18
Show Gist options
  • Save ahl/f8686793469df4479183229e24348221 to your computer and use it in GitHub Desktop.
Save ahl/f8686793469df4479183229e24348221 to your computer and use it in GitHub Desktop.
white = digitalio.DigitalInOut(board.C1)
black = digitalio.DigitalInOut(board.C0)
black.direction = digitalio.Direction.OUTPUT
black.value = True
white.direction = digitalio.Direction.OUTPUT
white.value = True
def tap(v):
tnext = time.time()
white.value = False
value = True
for t in v:
tnext += t / 1000
while time.time() < tnext:
pass
white.value = value
value = not value
def left():
tap([17.7 + 15.7, 2, 2, 2, 4, 2, 2, 2, 2])
def right():
tap([17.7 + 15.7, 2, 2, 2, 4, 2, 2, 2, 4])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment