Shop OBEX P1 Docs P2 Docs Learn Events
need help with code...... — Parallax Forums

need help with code......

LouLou Posts: 3
edited 2005-04-14 15:48 in BASIC Stamp
shocked.gif·OK so im a little new to stamps,code and circuitry. I have been giving myself a crash course as of late so i have some knowledge base. I'm trying to make a toy tank. The idea is for the tank to sense the edge of a table using a ping ultrasonic rangefinder. I'm using a· basic stamp homework board, 2 continous rotation servos with a servo controller (all parallax).I have found examples of code for individual components but no examples of how to integrate all these into a single program. I know the get sonar sub routine for the senro, but how or should i say where do I put the servo commands? I just want it to sense the edge, back-up for 2 seconds and do a 180 deg. turn then repeat. Any help even an outline is appreciated!!

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-04-12 15:05
    Hello,

    ·· I would recommend reading the "What's A Microcontroller?" text, available as a free download from our website.· Please go to Books/Stamps In Class Curriculum.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-04-12 15:27
    And I believe our Robotics text actually has an edge-detection experiment using IR sensors -- probably a better sensor for that application.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas, TX· USA
  • JurgenJurgen Posts: 8
    edited 2005-04-12 15:28
    The text for the BOEBOT could help you a lot too!

    Can also be found on the Parallax site.


    edit: <oops wrote this at the same time as Jon roll.gif >
  • LouLou Posts: 3
    edited 2005-04-12 18:57
    Is my choice of the ping ultrasonic sensor capable of giving me the edge detection capabilities? I plan on mounting the sensor at the end of the tanks barrel which will be approx 6 cm off the table.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-04-13 02:44
    Lou,

    ·· If it's at the end of the barrel and aiming downward, it certainly will.· What you have to watch out for with any sonar sensor is that it's not trying to peek over the edge.· The PING))) sees in a cone shape, and so if it's mounted at the front of the tank looking downward and part of the tank is in it's FOV (Field Of View) you will get inconsistent readings.

    ·· What you propose should work fine as long as the PING))) is looking past the barrel.· I hope you understand what I am saying.· If not I will post a (crappy) graphic.·

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • LouLou Posts: 3
    edited 2005-04-13 22:46
    Chris yes please draw me a sketch if you would (crappy is fine-best really). The sensor is actually mounted in the end of a cigar tube (a plastic one with an end cap). It is facing directly downward. The barrel will extend from the vehicle· approx. 3 inches(leading distance)·I want to have the sensor detect the consistant distance of the desktop, then when the barrel/sensor pokes over the edge it will sense a very large distance to the controller telling it to back up and do a 180. I have some idea as to the code for the sensor , the servo controller but i dont know how to integrate them, all the examples use infrared with no servocontroller.ughhhhhhhhhhhhhhhh.freaked.gif
    mayday help
    signed trying not to be code illiterate

    Post Edited (Lou) : 4/13/2005 10:49:53 PM GMT
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-04-14 15:48
    Lou,

    ·· Using your example of mounting inside of a tube, here's what I mean about trying to avoid the signal hitting surfaces around the mounting area.· Yes it's a crappy drawing done in MS Paint!· tongue.gif· You'll have to experiment to find the best position for it as well...Protruding from the tube might even work better.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
    512 x 384 - 13K
Sign In or Register to comment.