Open main menu
Home
Random
Log in
Settings
About Sugar Labs
Disclaimers
Sugar Labs
Search
Changes
← Older edit
Newer edit →
Activities/Turtle Art/Programmable Brick
(view source)
Revision as of 17:34, 28 August 2011
435 bytes added
,
17:34, 28 August 2011
→Device I/O
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===
Tonyforster
2,486
edits