Hi all,
I have here some 8M2 and 14M2.
I tried to measure the distance on a 8M2 with a SRF005 and it works great with this code:
But when I try to use it on a 14M2 I get no results.
I also tried to use the pins B.1 and B.2 on the 14M2 but it also doesn't help.
Anyone knows what I'm doing wrong here?
Cheers
Florian
I have here some 8M2 and 14M2.
I tried to measure the distance on a 8M2 with a SRF005 and it works great with this code:
Code:
symbol trig = C.1 ; Define pin for Trigger & Echo (All M2, X2 parts)
symbol echo = C.2
symbol range = w1 ; 16 bit word variable for range
main: pulsout trig,2 ; produce 20uS trigger pulse (must be minimum of 10uS)
pulsin echo,1,range ; measures the range in 10uS steps
pause 20 ; recharge period after ranging completes
; now convert range to cm (divide by 5.8) or inches (divide by 14.8)
; as picaxe cannot use 5.8, multiply by 10 then divide by 58 instead
let range = range * 10 / 58 ; multiply by 10 then divide by 58
debug range ; display range via debug command
goto main
I also tried to use the pins B.1 and B.2 on the 14M2 but it also doesn't help.
Anyone knows what I'm doing wrong here?
Cheers
Florian