File tree Expand file tree Collapse file tree
assignments/03-game-controller-discover Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -11,20 +11,18 @@ has_children: false
1111
1212``` python
1313while True :
14- if button.value is True :
1514 if current_state is state_wait:
16- keyboard.press(key) # Send our defined key as a command...
17- print (" button is pressed" ) # Print a confirmation in the serial monitor
18-
19- current_state = state_button_is_pressed # Update our state
20-
21- elif button.value is False :
15+ if button.value == True :
16+ keyboard.press(key) # Send our defined key as a command...
17+ print (" button is pressed" ) # Print a confirmation in the serial monitor
18+ current_state = state_button_is_pressed # Update our state
19+
2220 if current_state is state_button_is_pressed:
23- keyboard.release_all() # and release all keys again
24- print ( " button is released " ) # Print a confirmation in the serial monitor
25-
26- current_state = state_wait # Reset the state
27-
21+ if button.value == False :
22+ keyboard.release_all() # and release all keys again
23+ print ( " button is released " ) # Print a confirmation in the serial monitor
24+ current_state = state_wait # Reset the state
25+
2826 # Sleep briefly so keypress events occur at a human timescale.
2927 # Skilled users can manage ~7 button presses per second, so we
3028 # sample at roughly twice that rate to satisfy the Nyquist criterion.
Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ Your assignment is to use the template code and the acting machine diagram here
4747
4848| Acting Machine Diagram |
4949| -------------------------------------- |
50- | ![ ] ( stateDiagram .png) |
50+ | ![ ] ( state_diagram_corrected .png) |
5151
5252### Code template
5353
You can’t perform that action at this time.
0 commit comments