Activities/Turtle Art/Programmable Brick: Difference between revisions

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