Thanks all,
I did the suggested changes, but with no luck. :(
I used the same code below for both bad and good examples:
''#terminal 9600
symbol echo = c.0
symbol trig = c.1
symbol res = w0
OUTPUT trig
main:
pause 100
pulsout trig, 2
pulsin echo, 1, res
w1 = res * 5 /...