ROBOTC.net forums http://robotc.net/forums/ |
|
Program only giving power to one motor http://robotc.net/forums/viewtopic.php?f=11&t=13443 |
Page 1 of 1 |
Author: | Team 255Z [ Tue Feb 23, 2016 6:13 pm ] | |||||||||
Post subject: | Program only giving power to one motor | |||||||||
So I learned how to use robotc just recently, programmed my tank drive, it worked. Then I made a pinball hammer for the nothing but net game. I wanted to program it to the right shoulder buttons, being an fps gamer, and being used to that, on the main controller. As soon as I did so, the program would only ever give power to the left front motor on the drive train. Can sombody help me fix this, and tell me why this happens? my program:
|
Author: | CARBOT [ Wed Feb 24, 2016 6:33 pm ] |
Post subject: | Re: Program only giving power to one motor |
A while statement will do one of the following: 1) Run all lines within braces{} immediately following the while or 2) Run the next line of code You should add braces {} after the while statements just like the if statements. |
Author: | Team 255Z [ Thu Feb 25, 2016 6:18 pm ] |
Post subject: | Re: Program only giving power to one motor |
Ahh the drive train works now, thank you. Having a bit of trouble with getting the program to give power to the pinball motor though |
Author: | CARBOT [ Sat Feb 27, 2016 7:52 pm ] |
Post subject: | Re: Program only giving power to one motor |
Post your code so we can see how your while loops are structured. |
Author: | Elohira [ Thu Oct 12, 2017 9:28 pm ] |
Post subject: | Re: Program only giving power to one motor |
If you say while(true) it will run forever. You can only have one while(true) loop because you will never leave it. So this will only run the first set of statements. If you adjust it so all the code is inside the first while(true) loop it should work. |
Page 1 of 1 | All times are UTC - 5 hours [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |