File tree Expand file tree Collapse file tree 5 files changed +38
-0
lines changed Expand file tree Collapse file tree 5 files changed +38
-0
lines changed Original file line number Diff line number Diff line change 1+ # Add your Python code here. E.g.
2+ from microbit import *
3+ import time
4+
5+ while True :
6+ if pin0 .is_touched ():
7+ display .show (Image .DUCK )
8+ sleep (10 )
9+ elif pin1 .is_touched ():
10+ display .show (Image .COW )
11+ sleep (10 )
12+ elif pin2 .is_touched ():
13+ display .show (Image .BUTTERFLY )
14+ sleep (10 )
15+ else :
16+ display .show (Image .SKULL )
17+ sleep (1 )
Original file line number Diff line number Diff line change 1+ # Add your Python code here. E.g.
2+ from microbit import *
3+ import time
4+ import music
5+
6+ while True :
7+ if pin0 .is_touched ():
8+ tune = ["A2:4" ]
9+ music .play (tune )
10+ sleep (4 )
11+ elif pin1 .is_touched ():
12+ tune = ["B2:4" ]
13+ music .play (tune )
14+ sleep (4 )
15+ elif pin2 .is_touched ():
16+ tune = ["C2:4" ]
17+ music .play (tune )
18+ sleep (4 )
19+ else :
20+ display .show (Image .SKULL )
21+ sleep (1 )
You can’t perform that action at this time.
0 commit comments