jumeaux-numeriques/portail_coulissant/porcou_cmd.py
2022-12-05 14:07:17 +01:00

53 lines
1.9 KiB
Python
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import bge # Bibliothèque Blender Game Engine (UPBGE)
from porcou_lib import * # Bibliothèque portail coulissant
###############################################################################
# porcou_cmd.py
# @title: Commandes du portail coulissant
###############################################################################
###############################################################################
# Gestion des tâches (threads) << NE PAS MODIFIER CETTE SECTION >>
###############################################################################
threads=[]
scene = bge.logic.getCurrentScene()
def start():
thread_start(threads, commandes)
def stop():
thread_stop(threads)
###############################################################################
# Instructions élémentaires pour le portail coulissant
#
# Actions (ordre = True ou False) :
# - Gyrophare : gyr (True|False)
# - Ouvrir le portail (moteur sens trigo) : mot_o (True|False)
# - Fermer le portail (moteur sens horaire) : mot_f (True|False)
# - Emetteur pour le capteur barrage IR : ir_emet(True|False)
#
# Capteurs (valeur retournée = True ou False) :
# - Capteur fin de course portail ouvert : fc_o()
# - Capteur fin de course portail fermé : fc_f()
# - Capteur barrage IR (absence d'obstacle) : ir_recep()
#
# Pupitre (valeur retournée = True ou False) :
# - Bouton poussoir coté rue : bp_ext()
# - Bouton poussoir coté cour : bp_int()
#
# Gestion du temps :
# - Temporisation en seconde : tempo(duree)
#
###############################################################################
def commandes():
# Coder vos commandes ici ...
gyr(True) # Activer le gyrophare
print ("Thread #", len(threads)-1, "arrivé au bout -> fermeture.") # Tâche close (thread) << NE PAS MODIFIER CETTE LIGNE >>
scene.objects['Systeme']['thread_run']=False # Fin du cycle << NE PAS MODIFIER CETTE LIGNE >>