Active Topics

 


Reply
Thread Tools
Posts: 145 | Thanked: 32 times | Joined on Dec 2007
#1
There's another thread that shows how to use python
to control the LEDs; this can be easily integrated into
a battery monitor script so that when your battery gets
below a certain level the LEDs start blinking red.

For example, here's my battery monitor script:

Code:
#!/bin/sh
X=`battery-status | awk '{print $4}'`
if [ ${#X} -lt 5 ]
then
  play-sound /usr/local/kde/share/sounds/KDE_Notify.wav &
  kdialog --title "Battery Status" --msgbox ". . . . . . . . .  $X  . . . . . . . . ." &
  python /home/user/blinkenlight &
fi
This runs every 10 minutes via cron (yes, if you look you
can find a cron that runs on the n810).

the python script looks like this (thanks to eber42):

Code:
#! /usr/bin/python

import time
import dbus
bus = dbus.SystemBus()
obj = bus.get_object('com.nokia.mce','/com/nokia/mce/request')
iface = dbus.Interface(obj,dbus_interface='com.nokia.mce.request')
led_pattern = 'PatternError'

# led on
iface.req_led_pattern_activate(led_pattern)

# wait 5s
time.sleep(5)

# led off
iface.req_led_pattern_deactivate(led_pattern)
Well, it's fun if nothing else ...
 
Posts: 157 | Thanked: 96 times | Joined on Nov 2007 @ Oxford, UK
#2
You can control the LED from a shell script: no need for Python for something this simple. See Changing the led colour indicators?
 
Posts: 145 | Thanked: 32 times | Joined on Dec 2007
#3
thanks for that - much "cleaner"

Is there any central collection of "how to control your
tablet" tutorials and such that deals with things like
controlling LEDs etc?
 
Posts: 55 | Thanked: 6 times | Joined on Feb 2008
#4
no, there's not a central place for these types of info. you have search/google/hunt for them all over the interweb. i know it sux, but iiwii and it's something we all learn to tolerate.
 
tso's Avatar
Posts: 4,783 | Thanked: 1,253 times | Joined on Aug 2007 @ norway
#5
sadly...

there is a wiki on this page, dropping it there would be a nice start. or at the very least a link.

hmm, a gui front end for cron is maybe something this
tablet could make use off...
 
Reply

Tags
deprecated, kde, kde35


 
Forum Jump


All times are GMT. The time now is 17:30.