maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Development (https://talk.maemo.org/forumdisplay.php?f=13)
-   -   using led with python (https://talk.maemo.org/showthread.php?t=68690)

EmaNymton 2011-01-20 19:13

using led with python
 
Hi,
searching the internet for making my N900 led blinking I found following code:

Code:

#!/usr/bin/env python
# -*- coding: utf-8 -*-

import osso
import time

_MCE_SERVICE = 'com.nokia.mce'
_MCE_REQUEST_PATH = '/com/nokia/mce/request'
_MCE_REQUEST_IF = 'com.nokia.mce.request'
_ENABLE_LED = 'req_led_pattern_activate'
_DISABLE_LED = 'req_led_pattern_deactivate'
_VIBRATE = 'req_vibrator_pattern_activate'
_VIBRATE_PATTERN= 'PatternChatAndEmail'
_LED_PATTERN = 'PatternCommunicationIM'

osso_c = osso.Context('test', '0.1', False)
rpc = osso.Rpc(osso_c)

def led_flash():
    rpc.rpc_run(_MCE_SERVICE, _MCE_REQUEST_PATH,_MCE_REQUEST_IF,_ENABLE_LED,rpc_args=(_LED_PATTERN,"",""),use_system_bus=True)

def vibrate():
    rpc.rpc_run(_MCE_SERVICE, _MCE_REQUEST_PATH, _MCE_REQUEST_IF, _VIBRATE, rpc_args=(_VIBRATE_PATTERN,"",""),use_system_bus=True)


for i in range(3):
    led_flash()
    time.sleep(1)
for i in range(3):
    vibrate()
    time.sleep(1)

vibrate works as expected, led not. What am I missing?


All times are GMT. The time now is 05:02.

vBulletin® Version 3.8.8