Command QSPD and CHFA of the Motor Mount and Wheel Kit (#27971)
KevinKK
Posts: 27
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!!!
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
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
but right wheel·still clockwise rotation , why?