I'm not sure I understand what knind of help you need. However, there are 2 GOSUBs without labels, Gosub Motors and Gosub Sensors. I cannot
locate either Sensors or Motors.
It appears to me that what you have offered as "part of the source code" may be a merging of multiple programs, which when taken together, do not work. The reason I say that may be found below in this program that I downloaded from the Lynxmotion web site. It looks remarkably similar to part of the program in your posting:
' Program LINETRK.BS2
' Simple Line Tracking
x var byte
y var byte
left var byte
right var byte
lstop con 150
rstop con 150
left = lstop
right = rstop
lmax con lstop + 10
rmax con rstop + 10
lmin con lstop - 10
rmin con rstop - 10
start:
if in15 = 1 then skip1
left = lmax
right = rmax
gosub p_out
skip1:
if in14 = 1 then skip2
left = lmax
right = rmin
gosub p_out
skip2:
if in13 = 1 then skip3
left = lmin
right = rmax
gosub p_out
skip3:
gosub p_out
goto start
This may have originally been a Parallax Demsonstration program, I really couldn't say. I've no idea where the other parts of your program came from, but that code (above) will provide a simple line tracking function, if the wiring of the motors and sensors matches the program requirements. Although I have no method to actually test it, I suspect it works as is.
That being offered, let's see if we can go from here.
GOSUB is a command look it up in the PBasic help in the latest version of the Basic Stamp editor. Briefly GOSUB means GO to a SUBroutine ,that you have written and placed in your program, and execute that code. GOSUB functions with the RETURN command. I suggest you study both of them in the help section. Things will start to make more sense.
Comments
locate either Sensors or Motors.
It appears to me that what you have offered as "part of the source code" may be a merging of multiple programs, which when taken together, do not work. The reason I say that may be found below in this program that I downloaded from the Lynxmotion web site. It looks remarkably similar to part of the program in your posting:
' Program LINETRK.BS2
' Simple Line Tracking
x var byte
y var byte
left var byte
right var byte
lstop con 150
rstop con 150
left = lstop
right = rstop
lmax con lstop + 10
rmax con rstop + 10
lmin con lstop - 10
rmin con rstop - 10
start:
if in15 = 1 then skip1
left = lmax
right = rmax
gosub p_out
skip1:
if in14 = 1 then skip2
left = lmax
right = rmin
gosub p_out
skip2:
if in13 = 1 then skip3
left = lmin
right = rmax
gosub p_out
skip3:
gosub p_out
goto start
p_out:
pulsout 0, (left * 5)
pulsout 1, (right * 5)
pause 20
return
This may have originally been a Parallax Demsonstration program, I really couldn't say. I've no idea where the other parts of your program came from, but that code (above) will provide a simple line tracking function, if the wiring of the motors and sensors matches the program requirements. Although I have no method to actually test it, I suspect it works as is.
That being offered, let's see if we can go from here.
Regards,
Bruce Bates