help me! problem
chris chance
Posts: 5
·i found some cool stuff for the·SRT04 sensor but nothing for a robot.
i have a bs2e and i try to use this code :
'{$STAMP BS2e}
'
' Devantech SRF04 Example
'
wDist·· VAR·· Word
INIT·· CON·· 14
ECHO·· CON·· 15
' CONVERSION FACTORS:
'
' The PULSIN command returns the round-trip echo time in 2us units
' which is equivalent to the one-way trip time in 1us units.
'
' distance = (echo time) / (conversion factor)
'
' use 74 for inches······ (73.746us per 1 in)
' use 29 for centimeters· (29.033us per 1 cm)
'
main
·· GOSUB sr_sonar
·· DEBUG HOME, DEC wDist, CR
·· PAUSE 100
·· GOTO main
sr_sonar:
·· PAUSE 100
·· PULSOUT INIT,5····· ' 10us init pulse
·· PULSIN ECHO,1,wDist·· ' measure echo time
·· PAUSE 10
·· RETURN
sr_sonar_2:
·· PULSOUT INIT,5····· ' 10us init pulse
·· OUTPUT INIT····· ' dummy command (delay)
·· RCTIME ECHO,1,wDist·· ' measure echo time
·· PAUSE 10
·· RETURN
i want to a simple code that i could use for my robot, as of now i just it mount to a servo on pin 13
the sensor is on pins 14 and 15
please help me
i have a bs2e and i try to use this code :
'{$STAMP BS2e}
'
' Devantech SRF04 Example
'
wDist·· VAR·· Word
INIT·· CON·· 14
ECHO·· CON·· 15
' CONVERSION FACTORS:
'
' The PULSIN command returns the round-trip echo time in 2us units
' which is equivalent to the one-way trip time in 1us units.
'
' distance = (echo time) / (conversion factor)
'
' use 74 for inches······ (73.746us per 1 in)
' use 29 for centimeters· (29.033us per 1 cm)
'
main
·· GOSUB sr_sonar
·· DEBUG HOME, DEC wDist, CR
·· PAUSE 100
·· GOTO main
sr_sonar:
·· PAUSE 100
·· PULSOUT INIT,5····· ' 10us init pulse
·· PULSIN ECHO,1,wDist·· ' measure echo time
·· PAUSE 10
·· RETURN
sr_sonar_2:
·· PULSOUT INIT,5····· ' 10us init pulse
·· OUTPUT INIT····· ' dummy command (delay)
·· RCTIME ECHO,1,wDist·· ' measure echo time
·· PAUSE 10
·· RETURN
i want to a simple code that i could use for my robot, as of now i just it mount to a servo on pin 13
the sensor is on pins 14 and 15
please help me
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Dallas Office
i need something smaller and easy to make in to a if..... then command
http://www.lynxmotion.com/images/jpg/cameron4.jpg
As for code to make the ranger scan, you would insert a routine that would move the servo a bit, then call up your main ranger code, take a reading, stuff the reading somewhere if you want, then move the servo again, range again, etc. The code I have is for a servo controller so it wouldn't be much help to you.
Post Edited (cabojoe) : 8/19/2004 2:21:39 AM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Dallas Office