HELPP i need this by tomorrow? 100% BEGINNER?
okay so we're doing some parallax robotics thing for school. I am TOTALLY unexperienced in robotics. We're using a boe-bot. What do I write in the program to make the boebot run straight for 36 seconds, and then stop? I need help finding out the duration of the FOR counter thingy. It only works sometimes, and sometimes it doesn't stop.
So the main problem is, is that whatever I write in the boebot doesn't stop at ALL. THis is what I write (ot including the other stuff). This is slightly unaaccurate
FOR counter = 1 to 1500 <<THIS PART i have no idea what to type for it to run 36 seconds
And for p12 and p13 i write in the numbers that make my boebot go straight, and at the end I write "PAUSE 20".
My main concern is what duration I put in for the FOR counter to make my boebot run for 36 seconds, and then STOP
I'm really unexperienced so sorry if i don't make sense.
So the main problem is, is that whatever I write in the boebot doesn't stop at ALL. THis is what I write (ot including the other stuff). This is slightly unaaccurate
FOR counter = 1 to 1500 <<THIS PART i have no idea what to type for it to run 36 seconds
And for p12 and p13 i write in the numbers that make my boebot go straight, and at the end I write "PAUSE 20".
My main concern is what duration I put in for the FOR counter to make my boebot run for 36 seconds, and then STOP
I'm really unexperienced so sorry if i don't make sense.
Comments
Its hard to believe this assignment was just dumped on you with one days notice.
So, you want it to run for 36 seconds. First tell us how long it runs with your existing program. After that, its simple ratio to adjust it for 36 seconds.
You can also look in the Help file of the programming environment to read up on the FOR-NEXT and PAUSE command.
Good luck.
But if you mean this, when I put if on FOR counter = 1 to 122, it runs for 3 seconds and then stops,if that makes any sense.
You can use these numbers to get close to the number you need. As Tom said, you could time how long it runs with your current code (which looks like it shouldn't be too far off) and then compensate for the difference in actual time taken and your target time.
There might be a problem somewhere else in your code. Use this link to learn how to post code in the forum.
But I tried FOR counter = 1 to 122, and I think it ran for like 3 seconds, if that helps?
Have you done the math yet to get an estimate of how many loops it will take?
Don't let school take the fun out of learning.
If the 3 seconds was accurate you'd use two equations and two unknowns.
122 * z = 3
and
x * z = 36
thanks but i'm presenting tomorrow and with a help of a friend and some cheating, i'll probably get a 3
That 3 ought to make everyone so proud!!
20ms x 122 loops = 2.44 seconds ... with a little over head that could be close to 3 seconds.
without looking at your program though it is difficult to tell.
in reality that 20ms is likely to range from 21ms to 23ms plus some overhead depending on the value of the pulse you are sending to the servo.
20ms Pause + (1ms to 2ms servo pulse) + program overhead
So... 2.56 seconds to 2.81 seconds plus any amount of overhead.... best thing to do is actually time it to figure out the unknown time of overhead so you can factor that back in. For better accuracy, set your loop grossly high.... example: 2440 for about 1 minute or 12200 for about 5 minutes and keep track of the value down to a second with a stopwatch.
Then take your loop value (2440 or 12200 or whatever you decide to use) and divide that by the number of seconds you determined with a stop watch. That will give you a better representation of how many loops per second you have. Finally, take your loops per second and multiply that by your 36 seconds you wish to run the servo for.