Go to Post Having a spare arm that you can put on in 5 minutes or less intimidates the hardware into not breaking. - ChrisH [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 10-02-2004, 18:06
Code\\Pilot Code\\Pilot is offline
< Only smart people see my avatar
AKA: Rafael Estrada
FRC #1065 (Tatsu)
Team Role: Programmer
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Florida
Posts: 53
Code\\Pilot is an unknown quantity at this point
Send a message via AIM to Code\\Pilot Send a message via MSN to Code\\Pilot
Switches...

Hello cool people from this wonderful forum.

I was wondering if there is a way to put switches on the robot like last year.
Remember? that you could set jumpers so the robot will do different things depending on the jumpers.
If there is a way, can you tell me how?
Cause i am writing a dead reck' code, so i wan it to be able to switch the code before the game, you know, like, if i am going to be on the right side, the code makes it go right, an the same with the left.
Thanks.

Oh, one more thing, be happy.

Code\\monkey.
__________________
Join the Red revolution, give me some RED rep!!!!
if it doesn't work, don't force it. Go get a bigger hammer.

int run = 0;
int robot_chasing_you = 1;

if (robot_chasing_you)
{
run = 254;
}

I got 48 Gmail invites left, pm me with your e-mail so i can send you one.
  #2   Spotlight this post!  
Unread 10-02-2004, 18:20
deltacoder1020's Avatar
deltacoder1020 deltacoder1020 is offline
Computer Guy
AKA: Dav
#1020 (The Indiana Prank Monkeys)
Team Role: Programmer
 
Join Date: Jan 2004
Location: Muncie, Indiana
Posts: 340
deltacoder1020 has a spectacular aura aboutdeltacoder1020 has a spectacular aura about
Send a message via AIM to deltacoder1020
Re: Switches...

just hook them up to a digital input pin, and use and if statement (or multiple if-elses) to select the code to run - you robot can read the input pins any time when it is on, including disabled mode.

you could even wire the switch up to one of the joystick ports on the OI and use that to switch the program - disabled mode allows input from the OI.
__________________
Team 1020, the Indiana Prank Monkeys (www.team1020.org)
  #3   Spotlight this post!  
Unread 10-02-2004, 19:42
Code\\Pilot Code\\Pilot is offline
< Only smart people see my avatar
AKA: Rafael Estrada
FRC #1065 (Tatsu)
Team Role: Programmer
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Florida
Posts: 53
Code\\Pilot is an unknown quantity at this point
Send a message via AIM to Code\\Pilot Send a message via MSN to Code\\Pilot
Re: Switches...

yeah, but i wasn't thinking 'bout a manual switch, where when you want to set it to some state, you just have to press something on the robot. With out touching the OI.
__________________
Join the Red revolution, give me some RED rep!!!!
if it doesn't work, don't force it. Go get a bigger hammer.

int run = 0;
int robot_chasing_you = 1;

if (robot_chasing_you)
{
run = 254;
}

I got 48 Gmail invites left, pm me with your e-mail so i can send you one.
  #4   Spotlight this post!  
Unread 10-02-2004, 20:48
Rhs953's Avatar
Rhs953 Rhs953 is offline
Revenge is near...
AKA: Mike
#0953 (Illumanati)
Team Role: Engineer
 
Join Date: Jan 2004
Location: Reno
Posts: 99
Rhs953 has a little shameless behaviour in the past
Send a message via AIM to Rhs953
Re: Switches...

yea make a switch box then figure out what the pin numbers are in 1 of your joystick. then wire by wire insert them into the proper pins.....so basically the compition will be over when your done.

Pluss in order to get the arm or whatever you are moving with a switch you need to use encoders so the program knows when to stop the motors.
  #5   Spotlight this post!  
Unread 10-02-2004, 21:47
Astronouth7303's Avatar
Astronouth7303 Astronouth7303 is offline
Why did I come back?
AKA: Jamie Bliss
FRC #4967 (That ONE Team)
Team Role: Mentor
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Grand Rapids, MI
Posts: 2,071
Astronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud of
Re: Switches...

Potentiometers. You know the angle (in pot units!)
  #6   Spotlight this post!  
Unread 10-02-2004, 22:19
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Switches...

Quote:
Originally Posted by deltacoder1020
you could even wire the switch up to one of the joystick ports on the OI and use that to switch the program - disabled mode allows input from the OI.
You would have to make sure not to try to read the switch after autonomous mode kicks in, as the OI inputs are not passed through then.
  #7   Spotlight this post!  
Unread 10-02-2004, 23:04
deltacoder1020's Avatar
deltacoder1020 deltacoder1020 is offline
Computer Guy
AKA: Dav
#1020 (The Indiana Prank Monkeys)
Team Role: Programmer
 
Join Date: Jan 2004
Location: Muncie, Indiana
Posts: 340
deltacoder1020 has a spectacular aura aboutdeltacoder1020 has a spectacular aura about
Send a message via AIM to deltacoder1020
Re: Switches...

Quote:
Originally Posted by Alan Anderson
You would have to make sure not to try to read the switch after autonomous mode kicks in, as the OI inputs are not passed through then.
there is that. however, one could simply put the code to read the sensor in Process_Data_From_Local_uP (or Process_Data_From_Master_uP) - thus, once the robot goes into autonomous mode, Process_Data_From_Local_uP is no longer called, and thus the switch value read will not be overwritten.
__________________
Team 1020, the Indiana Prank Monkeys (www.team1020.org)
  #8   Spotlight this post!  
Unread 11-02-2004, 08:53
Ryan M. Ryan M. is offline
Programming User
FRC #1317 (Digital Fusion)
Team Role: Programmer
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Ohio
Posts: 1,508
Ryan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud of
Re: Switches...

Quote:
Originally Posted by Code\\monkey
Hello cool people from this wonderful forum.

I was wondering if there is a way to put switches on the robot like last year.
Remember? that you could set jumpers so the robot will do different things depending on the jumpers.
If there is a way, can you tell me how?
Cause i am writing a dead reck' code, so i wan it to be able to switch the code before the game, you know, like, if i am going to be on the right side, the code makes it go right, an the same with the left.
Thanks.

Oh, one more thing, be happy.

Code\\monkey.
Here's an example of something you could do. I only use three switches, but this could be easily expanded.

The firstSwitch and such are the digital pins that the switches you are using are attched to.

User_Autonomous_Code() in fast_user_routines.c
Code:
 
#define SWITCH_ON 1 
#define SWITCH_OFF 0
 
User_Autonomous_Code()
{
	unsigned char autonomousSettings = 0;
 
	// Check switches for settings
	if(firstSwitch == SWITCH_ON)
		autonomousSettings += 1; 
	if(secondSwitch == SWITCH_ON)
		autonomousSettings += 2; 
	if(thirdSwitch == SWITCH_ON)
		autonomousSettings += 4;
 
 
	while(autonomous_mode) // This is the autonomous loop. The switches are evaluated before entering here
	{
		get_data();
 
		// In here, you can have things that use the settings
		switch(autonomousSettings)
		{
			case 1:  // Right side for autonomous mode 1
				break;
			case 2: // Left side for autonomous mode 1
				break;
 
			case 3:  // Right side for autonomous mode 2
				break;
			case 4: // Left side for autonomous mode 2
				break;
 
			case 5: // Right side for autonomous mode 3
				break;
			case 6: // Left side for autonomous mode 3
				break;
 
			case 7: // Misc empty for now. 
				break;
 
			default: // Use this for error checking
				printf("Something went wrong"); 
				break; // Force of habit
		}
 
		put_data();
	}
 
}
Well, anyway, I 'm too lazy to type any more. That should give you the idea, though.
__________________

  #9   Spotlight this post!  
Unread 16-02-2004, 12:26
SteveO SteveO is offline
Registered User
no team
 
Join Date: Jan 2003
Rookie Year: 2003
Location: NV
Posts: 122
SteveO will become famous soon enoughSteveO will become famous soon enough
Re: Switches...

I'm trying to do something similar to what codemonkey is doing. How would I go about making a switchbox for the robot (to attach to the rc)? Basically how do I return a "1" to a digital input.
  #10   Spotlight this post!  
Unread 16-02-2004, 12:47
deltacoder1020's Avatar
deltacoder1020 deltacoder1020 is offline
Computer Guy
AKA: Dav
#1020 (The Indiana Prank Monkeys)
Team Role: Programmer
 
Join Date: Jan 2004
Location: Muncie, Indiana
Posts: 340
deltacoder1020 has a spectacular aura aboutdeltacoder1020 has a spectacular aura about
Send a message via AIM to deltacoder1020
Re: Switches...

Quote:
Originally Posted by SteveO
I'm trying to do something similar to what codemonkey is doing. How would I go about making a switchbox for the robot (to attach to the rc)? Basically how do I return a "1" to a digital input.
it's really just a matter of closing the circuit between the GND and SIG pins of the digital input (someone correct me if I'm wrong). just hook up a switch in between the pins.
__________________
Team 1020, the Indiana Prank Monkeys (www.team1020.org)
  #11   Spotlight this post!  
Unread 16-02-2004, 12:50
Tom Bottiglieri Tom Bottiglieri is offline
Registered User
FRC #0254 (The Cheesy Poofs)
Team Role: Engineer
 
Join Date: Jan 2004
Rookie Year: 2003
Location: San Francisco, CA
Posts: 3,187
Tom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond repute
Re: Switches...

use an 8-way rotary switch. This way you can have up to 8 selections and it would be very easy to wire and program
  #12   Spotlight this post!  
Unread 16-02-2004, 12:54
SteveO SteveO is offline
Registered User
no team
 
Join Date: Jan 2003
Rookie Year: 2003
Location: NV
Posts: 122
SteveO will become famous soon enoughSteveO will become famous soon enough
Re: Switches...

Thanks, that was what I was hoping, the RC guide was unclear to me. Is it legal to use limit switches provided by innovation first in the EDU kit on the robot? We ordered some extra ones. I would have to rewire them because the +5v pin is in the middle of the grounds and sig's and they only have a 2 pin connector
  #13   Spotlight this post!  
Unread 16-02-2004, 13:13
Ryan M. Ryan M. is offline
Programming User
FRC #1317 (Digital Fusion)
Team Role: Programmer
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Ohio
Posts: 1,508
Ryan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud of
Re: Switches...

Quote:
Originally Posted by deltacoder1020
it's really just a matter of closing the circuit between the GND and SIG pins of the digital input (someone correct me if I'm wrong). just hook up a switch in between the pins.
Actually, and somebody should correct me if I'm wrong, the pins are pull ups, meaning they are normally on unless something connects the GND and SIG pins, which pushes them off. So, to turn it on, you don't close the GND and SIG pins. Or, I could be totally wrong and you'll have to yell at me.
__________________

  #14   Spotlight this post!  
Unread 16-02-2004, 13:23
SteveO SteveO is offline
Registered User
no team
 
Join Date: Jan 2003
Rookie Year: 2003
Location: NV
Posts: 122
SteveO will become famous soon enoughSteveO will become famous soon enough
Re: Switches...

I'm thinking it returns a "1" if you do close them, there is an indicator LED on the RC, too bad I don't have access to the "robot room" today to test this. I attached a banner sensor once, though, to a digital input and it indicated the switch variable was equal to "1" when the banner sensor detected white, that was of course with the white wire from the banner sensor..... oh well I'll figure out what it does tomorrow lol
Closed Thread


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
Limit switches Team168 Programming 8 10-02-2003 16:22
Team selector switches on ISAAC Lloyd Burns Robotics Education and Curriculum 0 17-12-2002 08:32
More than 2 aux switches in 1 port f22flyboy Programming 2 01-11-2002 14:44
Need help with custom switches archiver 2001 3 24-06-2002 00:35
Wiring custom toggle switches into operator interface DanL Electrical 9 13-02-2002 17:13


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

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