Merge pull request #284 from adafruit/ladyada-patch-3

Update cpx-mouse-buttons.py
This commit is contained in:
Mike Barela 2018-08-09 08:57:26 -04:00 committed by GitHub
commit bf0cf7486e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -6,11 +6,12 @@ m = Mouse()
while True:
if cpx.button_a:
m.press(Mouse.LEFT_BUTTON)
while cpx.button_a:
while cpx.button_a: # Wait for button A to be released
pass
m.release(Mouse.LEFT_BUTTON)
if cpx.button_b:
m.press(Mouse.RIGHT_BUTTON)
while cpx.button_b:
while cpx.button_b: # Wait for button B to be released
pass
m.release(Mouse.RIGHT_BUTTON)