Subject:
|
Sharp GP2D05?
|
Newsgroups:
|
lugnet.robotics.handyboard
|
Date:
|
Tue, 9 Mar 1999 03:10:19 GMT
|
Original-From:
|
edmund <HO106@stopspamSINGNET.COM.SG>
|
Viewed:
|
1095 times
|
| |
![Post a public reply to this message](/news/icon-reply.gif) | |
hello
anyone tried interfacing the Sharp GP2D05 sensors to the handyboard
before? i'm thinking of buying some as i need a reliable and cheap
digital(Yes/No) sensor. from what i can understand, there are 4
wires, Vin, Vcc, Gnd and Vout. the Vcc, Gnd and Vout can be
connected directly to the handyboard digital input while digital
input #9 can be configured as an output to provide a signal for Vin.
the operating procedure for the GP2D05 also sounds simple enough:
1. Pull the normally high(3V) Vin low(0V).
2. Wait 56ms.
3. Read Vout - if LOW(0V) --> no obstacle and vice versa.
4. Pull Vin to high again to Reset.
the question is, will the following code do the job? is it too
simple? from what i've seen, it seems that the GP2D02 requires
some complicated code to make it work with the handyboard.
bit_set(0x1000, 0x80); /* set digital output #9(Vin) low */
msleep(56L); /* delay for 56ms */
a=digital(5); /* read digital input #5 and store
the reading in int variable a. */
bit_clear(0x1000, 0x80); /* set digital #9 high to reset */
any comments, advice or criticism will be greatly appreciated. i'm
a robotics newbie and i'm afraid that i would spend a lot of money
buying a sensor that doesn't work. please help. thanks a million!
~edmund
|
|
1 Message in This Thread: ![You are here](/news/here.gif)
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|