Markbishop16
Member
Hope you all had a Happy Christmas and I wish you all a happy new year.
My problem:
I have a SRF005 that shows the display on a AXE133Y display, all works well, but;
If the distance is a single digit the number is steady.
If the distance is double digits, 10cms or over the display shows the distance but toggles between it and 0.
If I turn the delay in start1 up to 400ms the display works with out going to 0.
I want to use this as a reversing sensor in my garage, so I would like a quick response and a steady delay.
The program I have made from the PDF's and looking in the manual.
The 0 flashes up in the debug as well.
Thanks for your help
My problem:
I have a SRF005 that shows the display on a AXE133Y display, all works well, but;
If the distance is a single digit the number is steady.
If the distance is double digits, 10cms or over the display shows the distance but toggles between it and 0.
If I turn the delay in start1 up to 400ms the display works with out going to 0.
I want to use this as a reversing sensor in my garage, so I would like a quick response and a steady delay.
The program I have made from the PDF's and looking in the manual.
The 0 flashes up in the debug as well.
Code:
start0:
#picaxe 18m2 ; distance measured by Ultrasonic and displayed on OLED in cms
symbol SIG = C.1 ; Define pin for Trigger & Echo
symbol range = w1 ; 16 bit word variable for range
symbol LCD = b.7 ; output pin
symbol baud = n2400
Pause 500
serout LCD, baud,(254,1) ; clear display
pause 30
serout LCD,baud,(254,128) ;line 1 position 1
pause 30
serout LCD,baud,("Measured in cms "); top banner
pause 30
Main:
serout LCD,baud,(254,198,#range," "); distance line 2 in 6 places, the "" keep 4 digit display
pause 30
goto main
Start1:
pulsout SIG,2 ; produce 20uS trigger pulse (must be minimum of 10uS)
pulsin SIG,1,range ; measures the range in 10uS steps
; 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
pause 50 ; short delay
goto start1