This Forum is Dedicated For all The Object Oriented PIC Lovers .......... The concept behind OOPic is straight forward. Use preprogrammed multitasking Objects from a library of highly optimized Objects to do all the work of interacting with the hardware. Then write small scripts in Basic, C, or Java syntax styles to control the Objects. During operation, the Objects run continuously and simultaneously in the background while the scripts run in the foreground telling the objects what to do.

Sunday, April 13, 2008

[oopic] Re: Sharp GP2D12

--- In oopic@yahoogroups.com, "Mike Martin" <xaviour2me@...> wrote:
>
> Hello All (newbie question)
> I'd like to ask two things.
> 1)Is the diagram on http://www.oopic.com/gp2d12.htm wrong? The
> datasheet in the sensors & detectors folder in the files section have
> the pinout different to that on the oopic site (as well as the wiring
> colours). If I look at mine face-on, from left to right the wiring is
> yellow/black/red for Vo/GND/Voc but the website suggests GND/Voc/Vc.
> So you see, I'm having trouble figuring out if it even works.
> 2)Also, does someone have a code snippet (or a known working diagram)
> I could borrow to test it? I'm not entirely sure what to read from
> the IO line. What does IR.Value produce? So far all I can get out of
> it is an integer value of 46. I'm using B.1.0 firmware. How can a
> digital IOline read fluctuating voltages? Is it converted to varying
> pulses? The code I'm using is below:
>
> 'Turns on a RED LED - fishing for a value out of the IR
> Sub main()
> Red.IOLine = 1
> IR.IOLine = 3
> Red.Value = 0
> ooPIC.ExtVRef=0
> IR.Operate=cvTrue
> X = IR.Value
> If X = 46 Then 'discovered this value by trial and error
> Red.TurnOn
> End If
> Delay = 1000
> Red.TurnOff
> End Sub
>

Try this: http://www.acroname.com/examples/10012/10012.html

If you assign analog signals to IOLines 1..4 then all of them set to
analog. Similarly if you assign analog signals to IOLines 5..7 then
all of IOLines 1..7 are analog inputs. If you read them as a digital
input, you will get 0.

As a general guide: assign analog signals to IOLines 1..7, digital
inputs to IOLines 8..15 (you can use OOPic.PullUp = cvOn to use the
internal pull-up resistors) and digital outputs to IOLines 16 and up.
This is just a guide, not an absolute requirement.


Ignore the wiring on the OOPic page, it is wrong. There is a
datasheet here:
http://www.acroname.com/robotics/parts/SharpGP2D12-15.pdf

The pinout
is correct, be definition. Most web sites just make an approximation
- Acroname is correct, top to bottom, but show the connector
generically on the wrong side of the 'box'.

Looking at my MiniSumo, with the connector to the right, the wires are
red, black, yellow, to to bottom, which matches the datasheet and the
intent of the Acroname sketch.

Richard

------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:

http://groups.yahoo.com/group/oopic/

<*> Your email settings:
Individual Email | Traditional

<*> To change settings online go to:

http://groups.yahoo.com/group/oopic/join

(Yahoo! ID required)

<*> To change settings via email:
mailto:oopic-digest@yahoogroups.com
mailto:oopic-fullfeatured@yahoogroups.com

<*> To unsubscribe from this group, send an email to:
oopic-unsubscribe@yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:

http://docs.yahoo.com/info/terms/

No comments: