1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
| #!/usr/bin/python
# -*- coding: utf-8 -*-
# code Python obtenu avec l'IDE Pyduino - www.mon-club-elec.fr
from pyduino_pcduino import * # importe les fonctions Arduino pour Python
#!/usr/bin/python
# -*- coding: utf-8 -*-
# exemple pyDuino - par X. HINAULT - www.mon-club-elec.fr
# Juin 2013 - Tous droits réservés - GPLv3
# voir : https://github.com/sensor56/pyDuino
# bouton poussoir relance vidéo
from pyduinoMultimedia import * # importe les fonctions Arduino pour Python
# entete declarative
BP=2 # declare la broche a utiliser
APPUI=LOW #leur broche lors appui
filepathVideo=""
#noLoop=True
#--- setup ---
def setup():
# exemples de video :
# cd home/ubuntu/sources/video
# wget -4 http://www.mon-club-elec.fr/mes_videos/plancton_cnrs_fr.mp4
# wget -4 http://www.mon-club-elec.fr/mes_videos/incendium_vimeo.mp4
pinMode(BP,INPUT) # met la broche en entree avec rappel au plus actif
Serial.println("La broche 2 est en entree avec rappel au plus actif !")
global filepathVideo, filename
filepathVideo=homePath()+sourcesPath(VIDEO)
filename="aa.mp4 -loop 0"
print filepathVideo+filename
playVideo(filepathVideo+filename)
# -- fin setup --
# -- loop --
def loop():
global filepathVideo, filename
if(digitalRead(BP)==APPUI): # si appui
Serial.println("Appui BP!")
Serial.println("Joue la video : " +filepathVideo+filename)
stopVideo() #stoppe video deja lancee
playVideo(filepathVideo+filename)
# -- fin loop --
#--- obligatoire pour lancement du code --
if __name__=="__main__": # pour rendre le code executable
setup() # appelle la fonction main
while not noLoop: loop() # appelle fonction loop sans fin |
Partager