sonar problem
You may have other (not shown) code that handles this, but OUT0 = 0
(the effective result of "init VAR out0" with "init = 0") will not
drive I/O 0 low, and OUT0 = 1 will not drive it high...unless you
have also made I/O 0 an output. So whatever you're meaning to drive
off of I/O 0 may not be getting the control signals you intend:
init VAR out0
echo VAR in1
distance VAR word
on CON 1 '******* added
OUTPUT 0 '*******added
loop:
init = 0
distance = 0
init = 1
count:
if echo = on or distance > 255 then loop
distance = distance + 1
goto count
Regarding your second snippet, RCTIME wants a pin number (like '1'),
not a variable name (like "IN1") as the first argument:
RCTIME 1,0,distance
Steve
(the effective result of "init VAR out0" with "init = 0") will not
drive I/O 0 low, and OUT0 = 1 will not drive it high...unless you
have also made I/O 0 an output. So whatever you're meaning to drive
off of I/O 0 may not be getting the control signals you intend:
init VAR out0
echo VAR in1
distance VAR word
on CON 1 '******* added
OUTPUT 0 '*******added
loop:
init = 0
distance = 0
init = 1
count:
if echo = on or distance > 255 then loop
distance = distance + 1
goto count
Regarding your second snippet, RCTIME wants a pin number (like '1'),
not a variable name (like "IN1") as the first argument:
RCTIME 1,0,distance
Steve
Comments
the sonar system.
There are two polaroid 6500 boards in the sculpture, I have tied the
two echo pins together and attached the 4.7k pullup as specified on
the wirz faq site.
here is the code I have been using:
init VAR out0
echo VAR in1 'echo pins, tied together
with
'pullup
distance VAR word
loop:
init = 0
distance = 0 'set time variable to zero
'every time through loop
init = 1
count: 'counting loop, increments
'distance variable until
echo
'goes high
if echo = on of distance > 255 then loop ' have tried many different
'#'s here
distance = distance + 1 'increment counter
goto count
the problem is that the echo pin never goes high (echo pin is tied
high but driven low by the sonar board right?, so the program goes
through its count routine then rolls over and starts again.
I have also tried this bit o code that someone posted on this site a
while back:
distance VAR word
init VAR out0
echo VAR in1
loop:
init = 1 'turn on init
pause 3
Rctime echo, 0, distance
pause 20
init = 0
debug dec distance, cr
pause 500
goto loop
when I do this routine I get back "1" in the debug window, which will
change to "0" if I hold my hand right on top of the sonar disk, and
if
I wave my hand in front of the disk I will sometimes get a number
between "0-65535". Also this routine causes an indicator led on my
board-not attached to the sonar system to light up which probably
means that there is some unhelpful noise.
what am I doing wrong? This could be a hardware problem, although I
think is is simply my lack of understanding.
any help would be wonderful, I have 48 hours left get this thing
navigating.
P_stout@j...