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 16:21, 21 January 2012
5 bytes removed
,
16:21, 21 January 2012
→Device I/O
Line 198:
Line 198:
# The light sensor is only available on the XO 1.75
# The light sensor is only available on the XO 1.75
−
device = '/sys/devices/platform/olpc-ols.0/
power_state
'
+
device = '/sys/devices/platform/olpc-ols.0/
level
'
if os.path.exists(device):
if os.path.exists(device):
Line 232:
Line 232:
cmd='sudo chmod 777 {!s}'.format(devicestr)
cmd='sudo chmod 777 {!s}'.format(devicestr)
os.system(cmd) #caution! changing system file permissions
os.system(cmd) #caution! changing system file permissions
−
fd =open(devicestr, 'rb')
+
fd = open(devicestr, 'rb')
for x in range(12):
for x in range(12):
fd.read(1) #does not return till the switch state changes
fd.read(1) #does not return till the switch state changes
Walter
Bureaucrats
,
Administrators
10,579
edits