Hello,
I’m french: sorry for my english.
I try to make a robot like johnny 5 ( bigger).
I use a basic atom pro 28 and boatboard II .
It’s my first programme and i’ve a lot of trouble:
I want to commande my tracks with the pad of the PS2 joystick.
All work very well with the lynxmotion programme .
My prog:
[code]DAT con P12
CMD con P13
SEL con P14
CLK con P15
temp var byte
buttons var word
Lastbuttons var word
bpress1 var bit
bpress2 var bit
rhori var byte
rvert var byte
lhori var byte
lvert var byte
Dpad_haut var bit
Dpad_droite var bit
Dpad_gauche var bit
Dpad_bas var bit
moteur_droit var word
moteur_gauche var word
acceleration var word
increment var word
incrementation con 30
minvitesse con 2250
maxvitesse con 750
low p0
low p1
low p2
low p3
low p10
low p11
moteur_droit = 1500
moteur_gauche = 1500
high CLK
sound 9, [100\880, 100\988, 100\1046, 100\1175]
main
gosub get_PSX_data
increment = - acceleration
if Dpad_haut=1 and (Lastbuttons.bit4 = 0) then
moteur_droit=(1500-acceleration) min maxvitesse
moteur_gauche=(1500-acceleration) min maxvitesse
sound 9, [100\880]:pause 10
increment = incrementation;
endif
if dpad_bas=1 and (Lastbuttons.bit6 = 0) then
moteur_droit=(1500+acceleration) max minvitesse
moteur_gauche=(1500+acceleration) max minvitesse
increment = incrementation;
endif
if dpad_gauche=1 and (Lastbuttons.bit7 = 0) then
moteur_droit=(1500+acceleration) max minvitesse
moteur_gauche=(1500-acceleration) min maxvitesse
increment = incrementation;
endif
if dpad_droite=1 and (Lastbuttons.bit5 = 0) then
moteur_droit=(1500-acceleration) min maxvitesse
moteur_gauche=(1500+acceleration) max minvitesse
increment = incrementation;
endif
acceleration = acceleration + increment
pulsout 0,(moteur_droit*2)
pulsout 1,(moteur_gauche*2)
pause 20
goto main
get_PSX_data
Lastbuttons = buttons
low SEL
shiftout CMD,CLK,FASTLSBPRE,$1\8,$42\8]
shiftin DAT,CLK,FASTLSBPOST,[temp\8,buttons.LOWBYTE\8,buttons.HIGHBYTE\8,rhori\8,rvert\8,lhori\8,lvert\8]
high SEL
pause 1
buttons = buttons ^ $FFFF
Dpad_haut = Buttons.bit4
Dpad_droite = Buttons.bit5
Dpad_bas = buttons.bit6
Dpad_gauche = Buttons.bit7
return
[/code]
Could you help me for understand why it don’t work
thank
David