Here's the demo for the GP2D12.· I don't know if your 15 just means it's longer distance...or a different way for comms or serial integrated or whatever...but here's a starting point!
Just note I've customized this slightly for my own uses....so you might have to change it again for yourself.
Thanks. The GP2D12 is analog, while the GP2D15 is the digital version fixed at about 10" distance. It gives high and lows only. So it would definitely be very different from the GP2D12. however,·I do have a GP2D12 as well, so this is helpful. However,·I still need to know about the GP2D15.
Well, all you need to know should be in the datasheet.
Does it give back a certain pulse width for a given distance?· Or is it an encoded TTL signal?· (Rs232?)
Ok, I just read up on it real quick.· All that happens is that it sends it's "signal line" high when something comes within 24cm.
So, all you do is tell your stamp to look at the connected pin to see if it's a 1 or a 0.
So, if you have the signal line connected to pin 0...then,
GPsig con 0
if (GPsig = 1) then
Do all yer stuff here; turn on an LED; or whatever
endif
There are arguments on using the CASE function in place of IF's....your choice!· It's all in the help file in the Pbasic editor.
Comments
Just note I've customized this slightly for my own uses....so you might have to change it again for yourself.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·
Steve
http://members.rogers.com/steve.brady
http://www.geocities.com/paulsopenstage
"Inside each and every one of us is our one, true authentic swing. Something we was born with. Something that's ours and ours alone. Something that can't be learned... something that's got to be remembered."
Thanks!
I should be able to use the whisker logic described in the robotics text to get what I need. I will try that out.
·
Does it give back a certain pulse width for a given distance?· Or is it an encoded TTL signal?· (Rs232?)
Ok, I just read up on it real quick.· All that happens is that it sends it's "signal line" high when something comes within 24cm.
So, all you do is tell your stamp to look at the connected pin to see if it's a 1 or a 0.
So, if you have the signal line connected to pin 0...then,
GPsig con 0
if (GPsig = 1) then
Do all yer stuff here; turn on an LED; or whatever
endif
There are arguments on using the CASE function in place of IF's....your choice!· It's all in the help file in the Pbasic editor.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·
Steve
http://members.rogers.com/steve.brady
http://www.geocities.com/paulsopenstage
"Inside each and every one of us is our one, true authentic swing. Something we was born with. Something that's ours and ours alone. Something that can't be learned... something that's got to be remembered."
Cheers!