-
Notifications
You must be signed in to change notification settings - Fork 125
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #200 from jbanana/TinyTunes_1_2
TinyTunes 1.2
- Loading branch information
Showing
4 changed files
with
151 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,46 @@ | ||
import thumby | ||
|
||
repeat = 0 | ||
|
||
def whichButton(): | ||
if thumby.buttonU.justPressed(): | ||
return 'U' | ||
if thumby.buttonD.justPressed(): | ||
return 'D' | ||
if thumby.buttonL.justPressed(): | ||
return 'L' | ||
if thumby.buttonR.justPressed(): | ||
return 'R' | ||
if thumby.buttonA.justPressed(): | ||
return 'A' | ||
if thumby.buttonB.justPressed(): | ||
return 'B' | ||
global repeat | ||
if repeat >= 4: | ||
if thumby.buttonU.pressed(): | ||
return 'u' | ||
elif thumby.buttonD.pressed(): | ||
return 'd' | ||
elif thumby.buttonL.pressed(): | ||
return 'l' | ||
elif thumby.buttonR.pressed(): | ||
return 'r' | ||
elif thumby.buttonA.pressed(): | ||
return 'a' | ||
elif thumby.buttonB.pressed(): | ||
return 'b' | ||
else: | ||
repeat = 0 | ||
elif repeat > 0: | ||
if thumby.inputPressed(): | ||
repeat = repeat + 1 | ||
else: | ||
repeat = 0 | ||
else: | ||
if thumby.buttonU.justPressed(): | ||
repeat = 1 | ||
return 'U' | ||
if thumby.buttonD.justPressed(): | ||
repeat = 1 | ||
return 'D' | ||
if thumby.buttonL.justPressed(): | ||
repeat = 1 | ||
return 'L' | ||
if thumby.buttonR.justPressed(): | ||
repeat = 1 | ||
return 'R' | ||
if thumby.buttonA.justPressed(): | ||
repeat = 1 | ||
return 'A' | ||
if thumby.buttonB.justPressed(): | ||
repeat = 1 | ||
return 'B' | ||
return None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters