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 08:05, 27 August 2011
383 bytes added
,
08:05, 27 August 2011
→Device I/O
Line 165:
Line 165:
This Python block returns with the brightness sensor value in the heap.
This Python block returns with the brightness sensor value in the heap.
A range of parameters can be measured, for example, substitute any of
A range of parameters can be measured, for example, substitute any of
−
these
strings for the
string
in the program below.
+
the path
strings
in the table
for the
'device'
in the program below.
−
*
/sys/devices/platform/olpc-battery.0/power_supply/olpc-battery/current_now
+
−
*
/sys/devices/platform/olpc-battery.0/power_supply/olpc-battery/voltage_now
+
{| border=1 cellpadding=3 style="border: 1px solid white; border-collapse: collapse; background: #e3e4e5;"
−
*
/sys/devices/platform/dcon/backlight/dcon-bl/actual_brightness
+
|-style="background:#787878; color: white;"
+
! device !! path !! notes
+
|-
+
| battery current ||
/sys/devices/platform/olpc-battery.0/power_supply/olpc-battery/current_now
|| OLPC XO
+
|-
+
| battery voltage ||
/sys/devices/platform/olpc-battery.0/power_supply/olpc-battery/voltage_now
|| OLPC XO
+
|-
+
| screen brightness ||
/sys/devices/platform/dcon/backlight/dcon-bl/actual_brightness
|| OLPC XO
+
|-
+
| light sensor || /sys/devices/platform/olpc-ols.0/power_state || OLPC XO 1.75
+
|}
Line 182:
Line 192:
string = fh.read()
string = fh.read()
fh.close()
fh.close()
−
tw.lc.heap.append(
int
(string)) # append as
integer
value to heap
+
tw.lc.heap.append(
float
(string)) # append as
float
value to heap
else:
else:
tw.lc.heap.append(-1)
tw.lc.heap.append(-1)
Walter
Bureaucrats
,
Administrators
10,579
edits