Shop OBEX P1 Docs P2 Docs Learn Events
need a programmer for a very basic program — Parallax Forums

need a programmer for a very basic program

apacheapache Posts: 7
edited 2007-03-09 14:41 in BASIC Stamp
i am need of a programmer who can write a code that can receive data from a ultrasonic sensor and control a servo motor details will be given to the programmer. please contact me from gidiyorss@gmail.com

Comments

  • allanlane5allanlane5 Posts: 3,815
    edited 2007-03-09 14:41
    With the BS2, this is extremely simple to do.

    Purchase a BS2 with BOE, a 'ping' sensor package, and a servo from Parallax.

    The program will be something like:

    ServoPos VAR WORD
    PingDistance VAR WORD

    MAIN:
    GOSUB FindDistance
    GOSUB SetServo
    GOSUB RefreshServo
    PAUSE 20
    GOTO MAIN

    FindDistance:
    ' Do stuff here to activate the ping, use PULSIN to get the response,
    ' do some simple math to convert pulse-width to distance
    RETURN

    SetServo:
    ' Do stuff to adjust ServoPos so the servo does what you want it to.
    RETURN

    RefreshServo:
    PULSOUT ServoPin, ServoPos
    RETURN

    ' The two subroutines I've commented above probably will be less than 10 lines each.
    ' As you can see, this should be extremely simple.
Sign In or Register to comment.