Ok I have done part 1 with the Ultrasonics Project. So far I have the following code which I am using from the SRF004 DATASHEET.
symbol trig = 3 ‘ Define output pin for Trigger pulse
symbol echo = 6 ‘ Define input pin for Echo pulse
symbol range = w0 ‘ 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 10 ‘ 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 ‘ and around forever
I want to display readout through leds not DEBUG Command. Lets start with 4 leds. I am using the picaxe 18a. How do I modify the program to do this for me? I don't even know where to start. Please help. I am bored of the DEBUG command already. I want to see some colour now and unplug the programming cable so I test this away from my pc. Can anyone help me with this. Oh and do I need the 10k pull up on my input when using the SRF004.
symbol trig = 3 ‘ Define output pin for Trigger pulse
symbol echo = 6 ‘ Define input pin for Echo pulse
symbol range = w0 ‘ 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 10 ‘ 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 ‘ and around forever
I want to display readout through leds not DEBUG Command. Lets start with 4 leds. I am using the picaxe 18a. How do I modify the program to do this for me? I don't even know where to start. Please help. I am bored of the DEBUG command already. I want to see some colour now and unplug the programming cable so I test this away from my pc. Can anyone help me with this. Oh and do I need the 10k pull up on my input when using the SRF004.