Personal tools
Document Actions

Bashfr random quote reader

Up to Scripts

Bashfr random quote reader

Posted by skapin gaelle at December 27. 2008

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



Attachments

Re: Bashfr random quote reader

Posted by Eric LESCAUDRON at December 27. 2008
Hello gaëlle,



If your Tux arrive next monday, your script don't work, you use in your script ,API of Tux V1 (tux.cmd...)



Monday you will receive a tux V2



you can see the new API here http://doc.tuxisalive.com/api/





Re: Bashfr random quote reader

Posted by skapin gaelle at December 27. 2008

tanks a lot,


changes done, here is the v2 version.




Attachments

Re: Bashfr random quote reader

Posted by Eric LESCAUDRON at December 27. 2008
tux.tts.select_voice(SPK_FR_MALE,100)  V1

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




Re: Bashfr random quote reader

Posted by skapin gaelle at December 27. 2008

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


Re: Bashfr random quote reader

Posted by mongolito404 at December 27. 2008
Hoi,

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
Powered by Ploneboard
You are here: Home Forum Scripts Bashfr random quote reader

Powered by Plone CMS, the Open Source Content Management System