|
Page 1 of 1
|
[ 5 posts ] |
|
why wont my line tracking code work correctly?
| Author |
Message |
|
themigthy
Rookie
Joined: Wed Dec 21, 2011 4:22 pm Posts: 26
|
 why wont my line tracking code work correctly?
I am basically just trying to run this piece of code for 1 second but it doesn't it just keeps on running. if(vexRT[Btn5U] == 1) { }
|
| Sat Jun 02, 2012 10:10 pm |
|
 |
|
magicode
Moderator
Joined: Tue Sep 14, 2010 9:19 pm Posts: 495
|
 Re: why wont my line tracking code work correctly?
Is this your whole code? Is there a while loop around the whole thing? In any case, here's how you would accomplish this with timers:
_________________ sudo rm -rf /
|
| Sun Jun 03, 2012 5:34 am |
|
 |
|
themigthy
Rookie
Joined: Wed Dec 21, 2011 4:22 pm Posts: 26
|
 Re: why wont my line tracking code work correctly?
Yes there is a while loop I just forgot to add it.
|
| Sun Jun 03, 2012 2:54 pm |
|
 |
|
JohnWatson
Site Admin
Joined: Thu May 24, 2012 12:15 pm Posts: 387
|
 Re: why wont my line tracking code work correctly?
Gotta stop the motors when you're done It's going through the loop for 1 second, but whatever the last state it was in (go left, go right, etc) is being held to the motor values until you stop them.Edit: I am entirely incorrect in this (I don't know why I thought this was true, this is what I get for trying to finish things right before the end of work  ), it might be something with the loop that's causing problems. Sorry for the misinformation!
_________________Check out our Blog! And our Facebook page! Need help? Take a look at our Wiki and our Forums.I just met you, And this is crazy, But here's my code now, So fix it, maybe? ~ Carly Rae Jepsen parody
Last edited by JohnWatson on Thu Jun 07, 2012 9:20 am, edited 2 times in total.
|
| Wed Jun 06, 2012 5:43 pm |
|
 |
|
mmckee
Moderator
Joined: Thu Jun 09, 2011 10:14 am Posts: 7 Location: Pittsburgh, PA
|
 Re: why wont my line tracking code work correctly?
themighty, can you post the while loop? If your code never stops, it is usually an issue relating to the condition of the while loop.
_________________Matt McKee Robotics Academy Carnegie Mellon University ROBOTC homepage Robotics Academy homepage
|
| Thu Jun 07, 2012 8:53 am |
|
|
|
Page 1 of 1
|
[ 5 posts ] |
|
Who is online |
Users browsing this forum: sqiddster and 4 guests |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum
|
|