kopia lustrzana https://github.com/pimoroni/pimoroni-pico
Merge pull request #48 from SimUKdev/patch-1
Updated demo.py with A/B/X/Y button examplepull/69/head
commit
890524ae9e
|
@ -34,8 +34,26 @@ while True:
|
|||
explorer.set_pen(0, 0, adc2 * 2)
|
||||
explorer.circle(90 + adc2, 66, 10)
|
||||
|
||||
explorer.set_pen(255, 255, 255)
|
||||
explorer.text("Plug a jumper wire from GP0 to AUDIO to hear noise!", 20, 110, 200)
|
||||
# example for the on-board A/B/X/Y buttons
|
||||
if explorer.is_pressed(explorer.BUTTON_A):
|
||||
explorer.set_pen(255, 255, 255)
|
||||
explorer.text("Button A pressed", 20, 110, 200)
|
||||
elif explorer.is_pressed(explorer.BUTTON_B):
|
||||
explorer.set_pen(255, 255, 255)
|
||||
explorer.text("Button B pressed", 20, 110, 200)
|
||||
elif explorer.is_pressed(explorer.BUTTON_X) and explorer.is_pressed(explorer.BUTTON_Y):
|
||||
explorer.set_pen(255, 255, 255)
|
||||
explorer.text("Buttons X and Y pressed", 20, 110, 200)
|
||||
elif explorer.is_pressed(explorer.BUTTON_X):
|
||||
explorer.set_pen(255, 255, 255)
|
||||
explorer.text("Button X pressed", 20, 110, 200)
|
||||
elif explorer.is_pressed(explorer.BUTTON_Y):
|
||||
explorer.set_pen(255, 255, 255)
|
||||
explorer.text("Button Y pressed", 20, 110, 200)
|
||||
else:
|
||||
# no button press was detected
|
||||
explorer.set_pen(255, 255, 255)
|
||||
explorer.text("Plug a jumper wire from GP0 to AUDIO to hear noise!", 20, 110, 200)
|
||||
|
||||
explorer.set_tone(i)
|
||||
|
||||
|
@ -58,4 +76,4 @@ while True:
|
|||
i = 1
|
||||
|
||||
explorer.update()
|
||||
time.sleep(0.01)
|
||||
time.sleep(0.01)
|
||||
|
|
Ładowanie…
Reference in New Issue