summaryrefslogtreecommitdiff
path: root/content/Informatique/wiimote.rst
diff options
context:
space:
mode:
Diffstat (limited to 'content/Informatique/wiimote.rst')
-rw-r--r--content/Informatique/wiimote.rst12
1 files changed, 7 insertions, 5 deletions
diff --git a/content/Informatique/wiimote.rst b/content/Informatique/wiimote.rst
index 019d9f2..eb6641d 100644
--- a/content/Informatique/wiimote.rst
+++ b/content/Informatique/wiimote.rst
@@ -7,6 +7,8 @@ Controling the wiimote (I)
:date: 2009-03-11
:tags: Programmation, Wiimote, Python
+:slug: controling-the-wiimote-i
+:lang: en
Creating the plugin for wminput
@@ -27,7 +29,7 @@ You can get it here :
About the code :
-::
+.. code-block:: python
import wmplugin
@@ -35,7 +37,7 @@ This import does not exist, but is created by wminput when executed. It provide
the connexion with the wminput core. Just put ( or link ) the script in the
wminput plugin path ( on my debian this is the /usr/lib/cwiid/plugins/ )
-::
+.. code-block:: python
def wmplugin_init(id, wiimote_arg):
wmplugin.set_rpt_mode(id, cwiid.RPT_IR | cwiid.RPT_BTN)
@@ -56,7 +58,7 @@ you can get the signification of all the parameters here : `actions list
If we want to define new butons, we just have to name them in the first list,
the'll be accessible in the configuration file as plugin.[buton\_name] = ACTION
-::
+.. code-block:: python
def wmplugin_exec(messages):
'''Wiimote callback managing method
@@ -81,7 +83,7 @@ way for passing throught is to use global variables. But it is unelegant and
can cause problems if we want to use our code in imports. So we'ill use a list
as default parameter and let python save it as you can see here :
-::
+.. code-block:: python
>>> def meth(a=[]):
... a.append(1)
@@ -97,7 +99,7 @@ as default parameter and let python save it as you can see here :
So the ir\_sensor.get\_movement method is defined with each parameter we
want to save as an optional list
-::
+.. code-block:: python
def get_movement(msg, _old_points=[], _old_position = [0, 0]):
return 0, 0