Shop OBEX P1 Docs P2 Docs Learn Events
Command QSPD and CHFA of the Motor Mount and Wheel Kit (#27971) — Parallax Forums

Command QSPD and CHFA of the Motor Mount and Wheel Kit (#27971)

KevinKKKevinKK Posts: 27
edited 2009-03-24 01:16 in BASIC Stamp
I have bought your Motor Mount and Wheel Kit (#27971) with Position Controller (#29319),and i have some simple question...

I wish to allow my car·stop and·turn continuous·but it cant..The following are the·source code·at your station

'--- User Constants & Variables ---
AllWheels··· CON····· 0
RightWheel·· CON····· 1············· 'ID of the right side Position Controller
LeftWheel··· CON····· 2············· 'ID of the left side Position Controller
CommPin····· CON····· 12············ 'communication bus pin
BaudValue··· CON····· 32············ 'for 19.2kbps
Wheel······· VAR····· Byte·········· 'Specifies which wheel to command for subroutines
Distance···· VAR····· Word·········· 'Used to set the travel distance
RxData······ VAR····· Word·········· 'Used to receive data
'--- Initialization ---
PAUSE 1000
SEROUT CommPin, BaudValue, [noparse][[/noparse]SREV + RightWheel]· 'Reverses the sensor on the right
SEROUT CommPin, BaudValue, [noparse][[/noparse]CLRP]·············· 'Clears any prior position info
'Go forward 350 positions
Wheel = AllWheels
Distance = 350
GOSUB GoDistance
'Continually check the position of each wheel
CheckLoop:
· Wheel = LeftWheel
· DEBUG "L= "
· GOSUB DisplayPosition
· Wheel = RightWheel
· DEBUG "· R= "
· GOSUB DisplayPosition
· DEBUG CR
· GOTO· CheckLoop
· END
'--- Subroutines ---
GoDistance:
· SEROUT CommPin, BaudValue, [noparse][[/noparse]TRVL + Wheel]
· SEROUT CommPin, BaudValue, [noparse][[/noparse]Distance.HIGHBYTE, Distance.LOWBYTE]
RETURN
DisplayPosition:
· SEROUT CommPin, BaudValue, [noparse][[/noparse]QPOS + Wheel]
· SERIN· CommPin, BaudValue, [noparse][[/noparse]RxData.HIGHBYTE, RxData.LOWBYTE]
· DEBUG SDEC RxData
RETURN

i·mark "SEROUT CommPin, BaudValue, [noparse][[/noparse]SREV + RightWheel]··and hoped that the car turn but result isn't i want...May I ask what have I done wrong?

And..can·you give me some example program·, such as·QSPD·and CHFA , tell me how to· use·these two·commands ,thank you your help!!!

Comments

  • FranklinFranklin Posts: 4,747
    edited 2009-03-22 17:19
    Somebody said...
    i·mark "SEROUT CommPin, BaudValue, [noparse][[/noparse]SREV + RightWheel]··and hoped that the car turn but result isn't i want...May I ask what have I done wrong?

    Can you tell me what it does do? That would help.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • playrobotplayrobot Posts: 4
    edited 2009-03-23 01:50
    I hope left wheel and a right wheel all counter-clockwise rotation so i take off SEROUT CommPin, BaudValue, [noparse][[/noparse]SREV + RightWheel] this command.

    but right wheel·still clockwise rotation , why?
  • playrobotplayrobot Posts: 4
    edited 2009-03-24 01:16
    somebody can help me plz?
Sign In or Register to comment.