i am a new user. I want to use Sharp 2Y0A21 on the brat but i don’t know how to read this distance value with basic micro??
for filter = 0 to 9
adin p0, temp(filter)
next
ir = 0
for filter = 0 to 9
ir = ir + temp(filter)
next
ir = ir / 10
;sound 9,[10\4000]
;serout s_out,i38400,[dec ir ,13]
return
Start with that. All the analog output Sharp sensors basically will work with your code. Things to consider is how fast the particular Sharp sensor reads and updates it’s range. An then there are scaling algorithms to convert to inches or mm’s.
in additon i connect Sharp 2Y0A21 TO AX3 pin (P16) then i want read value from basic micro studio. but in this code only give to us randomly values.
i give vs and vlogic separately do i vs and vlogic ground same ground???
sharp var word
main
adin 16,sharp
serout s_out,i9600,"Value:",dec sharp,13]
pause 250
goto main
Connect the analog ground to the VS ground at one point. The BB II boards have the 3-pin connectors already, ground is connected. So what are you using?