View Single Post
  #1   Spotlight this post!  
Unread 11-20-2015, 05:01 PM
jgrindle's Avatar
jgrindle jgrindle is offline
Losing Sleep
AKA: John Grindle
FRC #5122 (RobOTies)
Team Role: Programmer
 
Join Date: Nov 2014
Rookie Year: 2015
Location: Old Town, ME
Posts: 34
jgrindle will become famous soon enough
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");

}
If I get crazy with button pressing, or just wait a while, the code will just hang. The only way to get it out of this hanging state, is to disable it, then re-enable it. I have a video of it when working. When it hangs, it will only stay on the one variable, that it last was on. The code for driving on the other hand, will not hang.
__________________

FRC 2015 Season: Programmer, Electrical, PIDTuner, Safety Captain
FRC 2015 Off-Season: Programmer, CAD Designer, Driver, Drive Team Coach, Electrical, Mechanical, PIDTuner
Reply With Quote