Homepage
Activities
Events
Blogs
Lists
Develop
Translate
Chat
Changes
Jump to navigation
Jump to search
← 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
Navigation menu
Personal tools
Log in
Namespaces
Page
Discussion
Variants
Views
Read
View source
View history
More
Search
Sugar
Downloads
Get started
FAQs
News
Get involved
Activity pages
Submit bugs
Get the source
About Sugar Labs
Donate to Sugar Labs
Contact info
Teams
Activity Team
Design Team
Documentation Team
Development Team
Infrastructure Team
Marketing Team
Platform Team
Translation Team
Wiki Team
Quick Links
Oversight Board
Governance
Human Interface Guidelines
people.sugarlabs.org
Recent changes
Categories
Service index
Wiki help
Code of Conduct
Local Labs
About local labs
Projects
Sugar Network
Sugar Creation Kit
Sugar on a Stick
Sugarizer
TOAST
Using the Wiki
Special pages
Printable version
Google translations
Afrikaans
አማርኛ
العربية
azərbaycanca
Bahasa Indonesia
Bahasa Melayu
Sunda
беларуская
বাংলা
български
bosanski
català
Cebuano
čeština
Chi-Chewa
corsu
Cymraeg
dansk
Deutsch
eesti
Ελληνικά
English
español
Esperanto
euskara
فارسی
français
Frysk
Gaeilge
Gàidhlig
galego
ગુજરાતી
Hausa
Hawaiʻi
한국어
עברית
हिन्दी
հայերեն
hmn
hrvatski
Igbo
isiXhosa
isiZulu
íslenska
italiano
jw
ქართული
ಕನ್ನಡ
қазақша
ភាសាខ្មែរ
Kiswahili
Kreyòl ayisyen
Кыргызча
kurdî
ລາວ
Latina
latviešu
Lëtzebuergesch
lietuvių
magyar
македонски
മലയാളം
Malti
Māori
монгол
मराठी
မြန်မာဘာသာ
Nederlands
नेपाली
日本語
norsk
ਪੰਜਾਬੀ
پښتو
polski
português
română
русский
Gagana Samoa
Sesotho
سنڌي
chiShona
shqip
සිංහල
slovenčina
slovenščina
Soomaaliga
српски / srpski
suomi
svenska
tj
Tagalog
ไทย
тоҷикӣ
தமிழ்
తెలుగు
Tiếng Việt
Türkçe
українська
oʻzbekcha/ўзбекча
اردو
ייִדיש
Yorùbá
中文(台灣)
中文(中国大陆)