HELP PLEASE! question with our code
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
{$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
~livonia

{$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
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.