Shop OBEX P1 Docs P2 Docs Learn Events
School Project problems programing Chip — Parallax Forums

School Project problems programing Chip

ArchiverArchiver Posts: 46,084
edited 2002-12-09 06:45 in General Discussion
I'm working on a school project that is due on 12-10-02. I hope
someone out there can help me before this date but if not please
respond regardless. I'm using the BASIC Stamp 2 circut board. I'm
using the program BASIC Stamp editor v1.33. I have two servo motors
and a bumper switch. I have left servo on p7 right on p8 and the
bumper switch on p3. All I want it to do is travel forward hit the
swtch then back up 2 sec then turn 180 degrees(that I'll have to play
with for the timing) and continue forward until it hits the switch
again. Very simple but I'm new to this and all I have to go by is a
print off of someone elses program. I have very little if any
understanding of how to do this. If anyone is willing to help me
with this problem please help. If at all possable e-mail me at
Jkon20@a... (Subject: school project) so that I don't delete
thinking it's junk mail. Thanks

Jason

This is what I have so far.
_________________________________________________
'{$PORT COM1}
'{$STAMP BS2}

servo_left con 8
servo_right con 7
bumswitch var in3
counter var word

check_bumswitch:
if bumswitch = 0 then back

drive_servo:
pulsout servo_left,650
pulsout servo_right,850
next
goto check_bumswitch

back:
for counter = 2
pulsout servo_left,850
pulsout servo_right,650
next
goto left

left:
for counter = 3
pulsout servo_left,850
pulsout servo_left,850
next
goto drive_servo

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2002-12-09 06:45
    Give this a shot. Your biggest problem was that the FOR loops were
    constructed wrong.

    '{$STAMP BS2}
    servo_left con 8
    servo_right con 7
    bumswitch var in3
    counter var word

    check_bumswitch:
    if bumswitch = 0 then back

    drive_servo:
    pulsout servo_left,650
    pulsout servo_right,850
    goto check_bumswitch

    back:
    for counter = 0 to 10 'change 10 to adjust for time
    pulsout servo_left,850
    pulsout servo_right,650
    next

    left:
    for counter = 0 to 5 'change 5 to adjust for time
    pulsout servo_left,850
    pulsout servo_left,850
    next
    goto drive_servo


    Enjoy! It's fun.
    -Martin Hebel


    --- In basicstamps@yahoogroups.com, "jkon20 <jkon20@a...>"
    <jkon20@a...> wrote:
    > I'm working on a school project that is due on 12-10-02. I hope
    > someone out there can help me before this date but if not please
    > respond regardless. I'm using the BASIC Stamp 2 circut board. I'm
    > using the program BASIC Stamp editor v1.33. I have two servo
    motors
    > and a bumper switch. I have left servo on p7 right on p8 and the
    > bumper switch on p3. All I want it to do is travel forward hit the
    > swtch then back up 2 sec then turn 180 degrees(that I'll have to
    play
    > with for the timing) and continue forward until it hits the switch
    > again. Very simple but I'm new to this and all I have to go by is
    a
    > print off of someone elses program. I have very little if any
    > understanding of how to do this. If anyone is willing to help me
    > with this problem please help. If at all possable e-mail me at
    > Jkon20@a... (Subject: school project) so that I don't delete
    > thinking it's junk mail. Thanks
    >
    > Jason
    >
    > This is what I have so far.
    > _________________________________________________
    > '{$PORT COM1}
    > '{$STAMP BS2}
    >
    > servo_left con 8
    > servo_right con 7
    > bumswitch var in3
    > counter var word
    >
    > check_bumswitch:
    > if bumswitch = 0 then back
    >
    > drive_servo:
    > pulsout servo_left,650
    > pulsout servo_right,850
    > next
    > goto check_bumswitch
    >
    > back:
    > for counter = 2
    > pulsout servo_left,850
    > pulsout servo_right,650
    > next
    > goto left
    >
    > left:
    > for counter = 3
    > pulsout servo_left,850
    > pulsout servo_left,850
    > next
    > goto drive_servo
Sign In or Register to comment.