Activities/Turtle Art/Programmable Brick: Difference between revisions
Tonyforster (talk | contribs) |
|||
| Line 204: | Line 204: | ||
* microphone jack: /dev/input/event8 | * microphone jack: /dev/input/event8 | ||
* rotate, cursor, and game pad keys: /dev/input/event10 | * rotate, cursor, and game pad keys: /dev/input/event10 | ||
def myblock(tw, x): # ignores second argument | |||
import os | |||
devicestr='/dev/input/event3' #the ebook switch | |||
cmd='sudo chmod 777 {!s}'.format(devicestr) | |||
os.system(cmd) #caution! changing system file permissions | |||
fd =open(devicestr, 'rb') | |||
for x in range(12): | |||
fd.read(1) | |||
tw.lc.heap.append( ord(fd.read(1))) #do not return till the switch state changes | |||
fd.close | |||
===Understanding the structure of the Turtle Art program=== | ===Understanding the structure of the Turtle Art program=== | ||