Shop OBEX P1 Docs P2 Docs Learn Events
Sharp Sensors — Parallax Forums

Sharp Sensors

trini4lifetrini4life Posts: 4
edited 2008-05-15 05:19 in Learn with BlocklyProp
I am trying to get two Sharp IR sensors to work together,the first turns on for 50ms,then off, the 2nd for 50ms,then off. Any hints?

Comments

  • Bruce BatesBruce Bates Posts: 3,045
    edited 2008-04-13 22:44
    trini4life -

    Which Sharp sensors are you using?

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Involvement and committment can be best understood by looking at a plate of ham and eggs. The chicken was involved, but the pig was committed. ANON
  • trini4lifetrini4life Posts: 4
    edited 2008-04-17 19:20
    Hey Bruce. I'm using the Sharp GP2D120 distance IR sensors., along with the Parallax 28300 motherboard.
  • LilDiLilDi Posts: 229
    edited 2008-04-17 20:46
    The GP2D120 is an analog output device that ranges from about 0.4 volts to 3.3 vollts depending on the distance to the object. On powerup, the sensor takes about 45ms to stablize. If you are thinking digital, all you are seeing is an unstable voltage on the output for that 50ms. Then the output voltage varies with the distance detected. By placing an object about 4cm from the sensor, the output should be about 3.3 volts. At 30cm the output voltage should be about 0.4 volts.
  • trini4lifetrini4life Posts: 4
    edited 2008-04-18 12:21
    Thanks LilDi. Do you know any PBasic code to interface between the sensors and a Parallax(28300) motherboard? I'm having difficulty in writing to the AD converter on the board.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2008-04-18 18:43
    Here's a sample program, adapted from the GPIO3 doc, that reads ADC port 0 on socket "B" and outputs the value read via DEBUG. Try it with your sensor to see if you get data that makes sense.

    ' {$STAMP BS2pe}
    ' {$PBASIC 2.5}
    
    owio      PIN 6   ' PIN 10 for socket "A"; PIN 6 for socket "B".
    
    Voltage   VAR Word
    Busy      VAR Bit
    
    DO
      OWOUT Owio, 0, [noparse][[/noparse]%00001011]
      DO : OWIN Owio, 4, [noparse][[/noparse]Busy] : LOOP WHILE Busy
      OWIN Owio, 0, [noparse][[/noparse]Voltage.HIGHBYTE, Voltage.LOWBYTE]
      DEBUG DEC Voltage, CR
    LOOP
    
    
    



    -Phil
  • painisinmepainisinme Posts: 2
    edited 2008-05-14 14:32
    hi guys

    i'm building a robot which is supposed to run on 2 stepper motors until it senses an obstacle which is a specific distance away, say 10 cm? is there a way to program such that the motors will keep running until the desired distance is reached? im using the same sharp sensor as above. i have tried some ways but the stepper motors are vibrating too much. why is this so?

    thanks
  • Mike GreenMike Green Posts: 23,101
    edited 2008-05-14 16:01
    1) Please start your own thread rather than hijacking a "similar one".

    2) You will have to provide much more information than you've done. At a minimum, provide a circuit diagram of your robot as an attachment to your message. Also, attach your source program and make sure there are comments in it that explain what you're trying to do in that section of the program. Vibration may be due to your program being too slow between motor steps.
  • painisinmepainisinme Posts: 2
    edited 2008-05-15 05:19
    oops sorry my bad
Sign In or Register to comment.