Here is good working code for the Atom Pro and the SRF-04. The values are converted to inches before display. This is for the IDE 8.0.1.7 and will work with the Mini-ABB and the Bot Board II.
[code]wdist var word
low p10 ;pin to initiate the sensor
low P11 ;pin to measure the return pulse
main:
pause 10
pulsout p10, 20
pulsin 11, 0, toolong, 40000, wdist
wdist = wdist / 148 ;convert for inches
serout s_out, i9600, "Distance: ", sdec wdist, 13, 10] ;display result in terminal
goto main
toolong: ; if the program gets here the sensor is not functioning, or wired wrong
serout s_out, i9600, “Timeout, sensor is not working”, 13]
goto main[/code]