Help with 3 ping sensors
Robe
Posts: 13
{$STAMP BS2}
{$PBASIC 2.5}
······································· '· I Have written this code for 3 pings to
pingL1····· pin 5·······················navigate,but it seems like I am
pingL2····· pin 2······················ triggering all of them at the same time.
pingCF·····pin 15······················ Also I think my program is to long can
·············································can·anyone·help··················································
triggerL1· con 5······················· me with this program
triggerL2· con 5····················· I would greatly appreciate any help
triggerCF· con 5
scaleL1· con· $200
scaleL2· con· $200
scaleCF· con· $200
rawtoinL1· con·· 889
rawtoinL2· con·· 889
rawtoinCF· con·· 889
ishighL1··· con·· 1···················
ishighL2··· con··· 1
ishighCF··· con··· 1
islowL1···· con··· 0
islowL2···· con··· 0
islowCF··· con···· 0
rawdistL1·· var· word
rawdistL2·· var·· word
rawdistCF·· var· word
inchesL1···· var· word
inchesL2···· var··· word
inchesCF···· var··· word
DO
GOSUB·get_sonarL1
gosub· get_sonarL2
gosub·· get_sonarCF
inchesL1 = rawdistL1**rawtoinL1
inchesL2 = rawdistL2**rawtoinL2
inchesCF = rawdistCF**rawtoinCF
pulsout 13, 850
pulsout 12, 650········ ' go forward
if (inchesL1 = 1 or inchesL1 = 5 or inchesL1 = 6) then· '· HELP WITH pulsout 13, 850···················································· ' CAN I SHORTEN
Pulsout 12, 700
elseif (inchesL2 = 1) then
pulsout 13, ....
........
endif
loop
get_sonarL1:
"··············· "··
"··············· "
i
·
{$PBASIC 2.5}
······································· '· I Have written this code for 3 pings to
pingL1····· pin 5·······················navigate,but it seems like I am
pingL2····· pin 2······················ triggering all of them at the same time.
pingCF·····pin 15······················ Also I think my program is to long can
·············································can·anyone·help··················································
triggerL1· con 5······················· me with this program
triggerL2· con 5····················· I would greatly appreciate any help
triggerCF· con 5
scaleL1· con· $200
scaleL2· con· $200
scaleCF· con· $200
rawtoinL1· con·· 889
rawtoinL2· con·· 889
rawtoinCF· con·· 889
ishighL1··· con·· 1···················
ishighL2··· con··· 1
ishighCF··· con··· 1
islowL1···· con··· 0
islowL2···· con··· 0
islowCF··· con···· 0
rawdistL1·· var· word
rawdistL2·· var·· word
rawdistCF·· var· word
inchesL1···· var· word
inchesL2···· var··· word
inchesCF···· var··· word
DO
GOSUB·get_sonarL1
gosub· get_sonarL2
gosub·· get_sonarCF
inchesL1 = rawdistL1**rawtoinL1
inchesL2 = rawdistL2**rawtoinL2
inchesCF = rawdistCF**rawtoinCF
pulsout 13, 850
pulsout 12, 650········ ' go forward
if (inchesL1 = 1 or inchesL1 = 5 or inchesL1 = 6) then· '· HELP WITH pulsout 13, 850···················································· ' CAN I SHORTEN
Pulsout 12, 700
elseif (inchesL2 = 1) then
pulsout 13, ....
........
endif
loop
get_sonarL1:
"··············· "··
"··············· "
i
·
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax