Go to Post UFH has substance. It puts the I in FIRST. - Andy Baker [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #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
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 10:49 AM.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi