Bashfr random quote reader
Up to Scripts
Hi,
I will receive my Tux droid next monday but i cannot wait to code something for it's arrival.
Here is a code that read a random quote on the french www.bahsfr.org site when the head button is pushed.
can you tell me if it's work, and how to make a gadget with it.
gaëlle
----------------------------------------------------------------
Bonjour,
je devrais recevoir mon tuxdroid lundi prochain mais je n'ai pas put attendre pour lui coder un petit quelquechose.
Ce code est censé faire lire au tuxdroid une quote aléatoire du site www.bashfr.org lorsqu'on lui appuie sur la tête.
pourriez-vous me dire si il marche et comment faire un gadget avec svp
gaëlle
If your Tux arrive next monday, your script don't work, you use in your script ,API of Tux V1 (tux.cmd...)
you can see the new API here http://doc.tuxisalive.com/api/
Gadget http://wiki.tuxisalive.com/index.php/Hello_World_Gadgets
for french :
http://gwadatux.free.fr
http://linux.ptigeek.net/?page_id=398
use tux.tts.setLocutor("Bruno")
tux.tts.setPitch(100)
tux.button.remote.waitPressed(9999, K_STANDBY) 9999 type int use float as 9999.99
but the script don't work, i don't know how to use head button and thread in python
--------------------------------------------------------------------------------------------------------------------
avec les modifications le script se connecte bien au serveur, mais après il boucle, même si j'appuie sur le bouton de tête, mais je ne sais pas comment gérer les boutons.
je sais que simplet dans son blog en a parlé
http://linux.ptigeek.net/?page_id=455
I have read all the (Uncomment codes) of the software_suite_v2 and I think that will make it :
out=1
def quitter():
out=0
if tux.access.waitAcquire(10.0, ACCESS_PRIORITY_NORMAL):
#here we bind button with callback functions
#ici on fait le lien des bouttons avec les fonctions
tux.button.head.registerEventOnPressed(threadmain)
tux.button.remote.registerEventOnPressed(quitter,K_STANDBY)
#here is the waiting loop (waiting for event on buttons)
while out == 1:
time.sleep(1)
and/or dont use thread and try directly with : tux.button.head.registerEventOnPressed(mymain)
anyway, I will handel this on monday as soon as I'll have install my little friend
a+
gaëlle
-------------------------------------------------------------------------------------------------
Je viens juste de finir de lire les codes (pas commenter grrrr) de software_suite_v2 et je pense que le code si dessus devrais marcher. sinon on peut essayer de zapper les threads et de lier directement le boutton a la fonction mymain.
de toute façon, je m'en occuperais lundi dès que j'aurais installer mon nouvel amis ...
a+
gaëlle
to loop until the stand by key is pressed, I used this code
while(not tux.button.remote.waitPressed(1000.0, K_STANDBY)):
pass
see http://gist.github.com/40256
--
Hoi,
pour boucler jusqu'a ce que le bouton stand by soit presse, j'utilise le coe suivant
while(not tux.button.remote.waitPressed(1000.0, K_STANDBY)):
pass
cf. http://gist.github.com/40256