Code: Select all
from microbit import *
switch=pin0
display.show("-")
while True:
if switch.read_digital():
break
begin=running_time()
bounce=[]
while running_time()-begin<7000:
display.show(str((running_time()-begin) // 1000))
if not switch.read_digital():
while not switch.read_digital():
pass
if switch.read_digital():
bounce.append(running_time()-begin)
# write results
display.scroll("bounces: "+str(len(bounce))+" ")
if bounce:
display.scroll("(")
for b in bounce:
display.scroll(str(b)+",")
display.scroll(")")
I get no bounces. I know if i had a real oscilloscope i'd see bouncing with the last 2 'switches'.