|
2007-09-01
, 11:24
|
Posts: 883 |
Thanked: 980 times |
Joined on Jul 2007
@ Bern, Switzerland
|
#2
|
#!/usr/bin/python2.5 # Example of using osso.DeviceState.display_state_on # You need to set the display brightness period to 10 seconds. # This example will bright the display after each 9.9 seconds. interval = 9000 #milliseconds #and the program will run 50 minutes (ctrl-c to abort when running) duration = 3 #minutes #init and calc-------------------------------------------------------------------------------------------- import osso import gobject count = 0 maxcount = 60*1000/interval*duration def blink_cb(device, loop): global count global maxcount device.display_state_on() count += 1 print count,maxcount if count == maxcount: loop.quit() return False return True def main(): global count loop = gobject.MainLoop() osso_c = osso.Context("osso_test_device_on", "0.0.1", False) device = osso.DeviceState(osso_c) device.display_state_on() gobject.timeout_add(interval, blink_cb, device, loop) print maxcount loop.run() if __name__ == "__main__": main()
|
2007-09-02
, 08:16
|
|
Posts: 87 |
Thanked: 1 time |
Joined on Mar 2006
|
#3
|
|
2007-09-02
, 08:41
|
Posts: 17 |
Thanked: 0 times |
Joined on Aug 2007
|
#4
|
Sorry if this has been asked before , I searched for 'backlight' in the forum but couldn't find any similar questions , nor any answers !
Last edited by mkstevo; 2007-09-01 at 10:09.