File tree Expand file tree Collapse file tree 1 file changed +23
-23
lines changed
Expand file tree Collapse file tree 1 file changed +23
-23
lines changed Original file line number Diff line number Diff line change 77
88# While the micro:bit is on
99while True :
10- # Pick a random direction
11- direction = directions [randrange (3 )]
12- display .show (direction )
13- # Sleep for a second (1000ms)
14- sleep (1000 )
10+ # Pick a random direction
11+ direction = directions [randrange (3 )]
12+ display .show (direction )
13+ # Sleep for a second (1000ms)
14+ sleep (1000 )
1515
16- # Get the X-axis (left-right) tilt
17- acc_x = accelerometer .get_x ()
18- # Determine direction
19- if acc_x < - 200 :
20- user_in = "L"
21- elif abs (acc_x ) < 200 :
22- user_in = "O"
23- elif acc_x > 200 :
24- user_in = "R"
16+ # Get the X-axis (left-right) tilt
17+ acc_x = accelerometer .get_x ()
18+ # Determine direction
19+ if acc_x < - 200 :
20+ user_in = "L"
21+ elif abs (acc_x ) < 200 :
22+ user_in = "O"
23+ elif acc_x > 200 :
24+ user_in = "R"
2525
26- # Check win condition
27- if user_in == direction :
28- # User input correctly
29- points += 1
30- else :
31- display .scroll (points )
32- display .show (Image .SAD )
33- points = 0
34- sleep (1000 )
26+ # Check win condition
27+ if user_in == direction :
28+ # User input correctly
29+ points += 1
30+ else :
31+ display .scroll (points )
32+ display .show (Image .SAD )
33+ points = 0
34+ sleep (1000 )
You can’t perform that action at this time.
0 commit comments