Bonjour à tous
J'essaye d'adapter un montage existant :
http://mikeshawcreates.blogspot.fr/2012/07/making-camera-ptz-decoder.html
Voici mon code (j'ai supprimé les recherche d'adresse, je ne l'utilise pas dans mes instructions conditionnelles) :
Je teste cela avec mon enregistreur qui a une sortie RS485, les commandes se font depuis une page web.
Ca fonctionne pas mal, mais si je reste cliqué sur une commande la sortie correspondante ''clignote''. Vu le code, cela a l'air normal .
Je voudrais que la sortie reste a l'état haut (sans coupures) tant que la commande est actionnée et tombe a l'état bas ensuite.
Auriez vous une piste a essayer ?
Merci d'avance
J'essaye d'adapter un montage existant :
http://mikeshawcreates.blogspot.fr/2012/07/making-camera-ptz-decoder.html
Voici mon code (j'ai supprimé les recherche d'adresse, je ne l'utilise pas dans mes instructions conditionnelles) :
Code:
Symbol haut = C.6 ' Tilt Up
Symbol bas = C.7 ' Tilt Down
Symbol droite = C.0 ' Pan Right
Symbol gauche = C.1 ' Pan Left
Symbol stx = b0
Symbol adr = b1
Symbol cmd1 = b2
Symbol cmd2 = b3
Symbol dat1 = b4
Symbol dat2 = b5
Symbol chks = b6
Symbol tmp = b8
Symbol RX_PIN = C.5 'Input from RS485 chip
Symbol RX_BAUD = T4800 'Baud fixed at true 4800
Do
Gosub GetPacket
Gosub HandlePacket
Loop
GetPacket:
Do
SerIn RX_PIN,RX_BAUD,stx,adr,cmd1,cmd2,dat1,dat2,chks
tmp = adr + cmd1 + cmd2 + dat1 + dat2
Loop Until tmp = chks
Return
HandlePacket:
if cmd2=$02 then high droite end If
if cmd2=$04 then high gauche end If
if cmd2=$08 then high haut end If
if cmd2=$10 then high bas end If
pause 1000
low droite,gauche,haut,bas
Return
Ca fonctionne pas mal, mais si je reste cliqué sur une commande la sortie correspondante ''clignote''. Vu le code, cela a l'air normal .
Je voudrais que la sortie reste a l'état haut (sans coupures) tant que la commande est actionnée et tombe a l'état bas ensuite.
Auriez vous une piste a essayer ?
Merci d'avance