Shop OBEX P1 Docs P2 Docs Learn Events
Code question for Sharp Sensor — Parallax Forums

Code question for Sharp Sensor

Soldier6575Soldier6575 Posts: 3
edited 2009-01-04 17:26 in BASIC Stamp
Hello All,

I am new to the Basic Stamp and this forum. I have a couple of Sharp GP2Y0A21YK sensors and was wondering if there was some code that I can use on the Basic Stamp that will allow me to test the sensors to make sure they are working, and how to hook up the sensor to the stamp for testing purposes.

Thank you in advance for your time.

Comments

  • MSDTechMSDTech Posts: 342
    edited 2009-01-02 03:28
    I haven't tried the GP2Y0A21YK, but the GP2D12 is very similar based on the datasheets. You can find instructions and code on the Crustcrawler website at:
    http://www.crustcrawler.com/code/index.php?prod=20
  • Soldier6575Soldier6575 Posts: 3
    edited 2009-01-03 00:18
    I dont understand that text file. I am just getting started with all this so it doesnt make sense to me yet.
  • FranklinFranklin Posts: 4,747
    edited 2009-01-03 03:19
    Could you show us how you have it hooked up to the stamp and what code you are trying to run? It would help us help you. You will need an ADC chip or some way to measure an analog voltage (RCTIME?).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen

    Post Edited (Franklin) : 1/3/2009 3:25:43 AM GMT
  • Soldier6575Soldier6575 Posts: 3
    edited 2009-01-03 04:36
    I dont have them hooked up yet. I used code I found to test the Ping))), which enabled me to see that it was broken and was able to exchange it for a new one. So that had me wondering if the Sharp sensors worked. So i was looking for a way to set it up on the breadboard and paste some code just to tell if they worked.

    Parallax had a tutorial with photos and clear instructions that allowed me to test the Ping. I havent found anything like that for the Sharp IR sensors. I just wondered if someone here may have a simple way to hook it up and test.

    I just got all this the other day so i still have a long way to go and a lot to learn yet.
  • FranklinFranklin Posts: 4,747
    edited 2009-01-03 20:33
    You could just hook a voltmeter to the output pin to ground and see if the voltage changes as objects approach the sensor

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • NoBo780NoBo780 Posts: 94
    edited 2009-01-04 17:26
    Franklin is right; that would be the easiest way to test them by simply using a voltmeter. If you plan on using the BASIC Stamp with the Sharp IR sensors, you will, as noted before, have to use an ADC chip because the Stamps don't have that built in, and the Sharp IR sensors output analog signals. If your application isn't particularly time-sensitive (aka if it's a robot, that is considered time-sensitive code), then you might be able to get by with an RCTIME circuit along with the sensors. Look in the Parallax PDF files (stamps in class), and in the forums for information on how to construct an RCTIME circuit. They're simple; all you need is a capacitor, maybe a resistor or two, and some wire.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Giggly Googley!
Sign In or Register to comment.