|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
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. |
|
#2
|
||||
|
||||
|
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. |
|
#3
|
|||||
|
|||||
|
Re: Switches...
Quote:
|
|
#4
|
||||
|
||||
|
Re: Switches...
Quote:
|
|
#5
|
|||
|
|||
|
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.
|
|
#6
|
||||
|
||||
|
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. |
|
#7
|
|||||
|
|||||
|
Re: Switches...
Potentiometers. You know the angle (in pot units!)
|
|
#8
|
||||
|
||||
|
Re: Switches...
Quote:
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();
}
}
That should give you the idea, though. |
|
#9
|
|||
|
|||
|
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
|
||||
|
||||
|
Re: Switches...
Quote:
|
|
#11
|
|||
|
|||
|
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
|
|||
|
|||
|
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
|
||||
|
||||
|
Re: Switches...
Quote:
Or, I could be totally wrong and you'll have to yell at me. ![]() |
|
#14
|
|||
|
|||
|
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
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
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 |