Go to Post FIRST is a pretty decent microcosm of real life, those who work hard, accomplish more decent lesson to learn, and FIRST is allowing us to learn it. - Aren_Hill [more]
Home
Go Back   Chief Delphi > Technical > Technical Discussion
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rating: Thread Rating: 3 votes, 5.00 average. Display Modes
Prev Previous Post   Next Post Next
  #24   Spotlight this post!  
Unread 13-04-2006, 00:10
Gary Bonner Gary Bonner is offline
Registered User
FRC #3974
 
Join Date: Jan 2002
Rookie Year: 2000
Location: PA
Posts: 120
Gary Bonner has a spectacular aura aboutGary Bonner has a spectacular aura about
Re: Potentiometer 5 or 6 detents

Here is a photo of our switch from last year, which was connected to the RC. It’s a six position switch with five 22k resistors (100k / (# positions - 1) = 20k, 22k was the closest we could find at Radio Shack). The switch positions were then 0k, 22k, 44k, 66k, 88k, & 110k. This would give analog values of about 0, 205, 410, 615, 820, and 1024. In the autonomous code, we looked for a range of 205, centered on each of those values.

Code:
void User_Autonomous_Code(void)
{
		.
		.
		.

	switch (((Get_Analog_Value( rc_ana_in01 )+100)/205)+1)	//read autonomous switch
	{  
		case 1:	//switch position 1 
	
			while (autonomous_mode)   /* DO NOT CHANGE! */
			{
				if (statusflag.NEW_SPI_DATA)      /* 26.2ms loop area */
				{
					Getdata(&rxdata);   /* DO NOT DELETE, or you will be stuck here forever! */

					/* Add your own autonomous code here. */
					
					Putdata(&txdata);   /* DO NOT DELETE, or you will get no PWM outputs! */
				}
			}
			break; //end of case 1
	
		case 2:	//switch position 2
	
			.
			.
			.

		default:
		{
			// something's wrong - do nothing
		}
	}  //switch
}  //User_Autonomous_Code

Last edited by Gary Bonner : 13-04-2006 at 00:13.
 


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Best source for a potentiometer? railerobotics Electrical 20 28-11-2007 22:24
Confused about potentiometer values Kirk Technical Discussion 4 11-03-2006 16:29
Potentiometer help Unholy Programming 4 07-02-2006 17:48
Potentiometer Help! thoughtful Programming 4 18-02-2005 08:21
Potentiometer Joshua May Technical Discussion 8 22-05-2004 19:51


All times are GMT -5. The time now is 14:23.

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