|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
Variables hanging?
Hey y'all,
If you search these forums frequently, you'll notice my last post was about a kiwi drive system. We are adding a Frisbee shooter to the top of it (for those that must know, it will be an inline shooter(using 6 inch wheels(direct driven by a CIM and a Mini-CIM))). I created speed selector for it using the D-Pad (code shown below) Code:
void Shooter::SpeedChanger(int dir){
switch(dir){
case 0:
if (change == false){
if (sped < 2){
sped = sped + 1;
printf("Speed up \n");
change = true;
}
}
break;
case 180:
if(change == false){
if(sped > 0){
sped = sped - 1;
printf("Speed Down \n");
change = true;
}
}
break;
default:
printf("Nothing\n");
change = false;
break;
}
printf("%d", sped);
printf("\n");
}
|
|
#2
|
||||
|
||||
|
Re: Variables hanging?
What might help is if you add printfs to every variable in the code segment and go through the logs. This helps track down the problem. If you could post them, other people would be able to help a lot more.
|
|
#3
|
||||
|
||||
|
Re: Variables hanging?
I can get an output of the riolog later, as I am currently at an FLL competition, there are printfs in the code.
John |
|
#4
|
||||
|
||||
|
Re: Variables hanging?
Alright. I'l look through them when you post them.
|
|
#5
|
|||
|
|||
|
Re: Variables hanging?
This sounds like an excellent time to use a debugger. Get it stuck, then stick a breakpoint at the top of your SpeedChanger method and step through, looking at the variable values. This is the best way to see why the code is not doing what you think it should.
http://wpilib.screenstepslive.com/s/...-robot-program |
|
#6
|
||||
|
||||
|
Re: Variables hanging?
Jreneew2,
I cannot get to posting a riolog. Eclipse will crash if I try to enter the riolog, when it hangs. Everything but the Frisbee shooter will run when it hangs. I find it odd, I'll limit my code to only the one subsystem, and try to see if that will work. |
|
#7
|
||||
|
||||
|
Re: Variables hanging?
Moving it to only the one method in the subsystems seemed to work. I couldn't do anything to get it to hang. I will try to implement everything else in a different way, but for now it seems to work.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|