Shop OBEX P1 Docs P2 Docs Learn Events
HELP PLEASE! question with our code — Parallax Forums

HELP PLEASE! question with our code

livonialivonia Posts: 2
edited 2008-11-14 15:59 in BASIC Stamp
We are·working on making our BOE-bot go straight and then turn quickly through having the wheels go opposite directions. ·We tried to set it up in a loop. ·The loop would repeat for a seemingly random number of times and then the wheels would only pause, not go opposite directions. ·I am pasting our code below. ·Any suggestions would be greatly appreciated!· I'm not sure what we're missing.· Thank you so much!
~livonia confused.gif
{$STAMP BS2}{$PBASIC 2.5}ben VAR Wordjim VAR WordFREQOUT 4, 2000, 3000Hello: FOR ben = 1 TO 100 PULSOUT 13, 800 PULSOUT 12, 700 PAUSE 20 NEXT FOR ben = 1 TO 100 PULSOUT 13, 800 PULSOUT 12, 800 PAUSE 20 NEXT GOTO HelloEND

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-11-14 15:46
    I don't know why you have the FREQOUT in your code. It doesn't have anything to do with your stated goal.

    Otherwise, what you wrote will cause the BoeBot to move roughly straight for about 2 seconds, then circle in one direction for 2 seconds, then repeat.

    Your batteries may be weak and once the BoeBot starts moving, their voltage drops below the point where the Stamp will run and it will reset starting the program over again.

    Try to be more precise in your explanation of what you're trying to do and what actually happens.
  • livonialivonia Posts: 2
    edited 2008-11-14 15:49
    Thank you so much! We will try new batteries. That makes sense because it does appear to be resetting itself. This was very helpful. So sorry about the vagueness.
  • allanlane5allanlane5 Posts: 3,815
    edited 2008-11-14 15:57
    Ah, I believe the FREQOUT is making a 'beep' ever time the BOE-Bot resets. Clever, that.
  • Don MooreDon Moore Posts: 4
    edited 2008-11-14 15:59
    Mike Green said...
    I don't know why you have the FREQOUT in your code. It doesn't have anything to do with your stated goal.

    Otherwise, what you wrote will cause the BoeBot to move roughly straight for about 2 seconds, then circle in one direction for 2 seconds, then repeat.

    Your batteries may be weak and once the BoeBot starts moving, their voltage drops below the point where the Stamp will run and it will reset starting the program over again.

    Try to be more precise in your explanation of what you're trying to do and what actually happens.

    Actually, I think that's why they have the FREQOUT command in their code in the first place.· The BoeBot manual talks about the robot resetting on brownouts and to easily detect this, they connect the piezo to pin 4 and leave it there for all the exercises.· If by chance the chip does reset due to power, the tone sounds upon program restart,·alerting the user that it's time to change out some new AA's.

    It does sound like what's happening though (bad battery problem)


    caviat: I'm not correcting you.· You seem to know about EVERYTHING in these forums so I was hesitant to post.· You amaze me in fact.· I just thought I might be able to answer as to why they had that code in there.
Sign In or Register to comment.