|
Re: limit switches
I searched and couldn't find and couldn't think through the code for:
I have a motor and 2 Limit Switches that sets the upper and lower limits of an arm from our 2003 Robot.
I want to have it so when I hit a Trigger on the joystick it sends the motor forward until it hits the Top limit switch or if it is already at the top to reverse the motor until it hits the Bottom Limit Switch.
I have:
#define T_DRIVE pwm01
#define Up_T_Limit rc_dig_in01 /* Limit Switch on Full Up Set */
#define Down_T_Limit rc_dig_in02 /* Limit Switch on Full Down Set */
#define T_BUTTON_BTN p2_sw_trig /* Button to change T state. */
/* T state variable. */
int intTState = 0;
Thanks in advance
<slightly off topic> This is for an off season project to convert our PBASIC 2003 robot into a vision robot for presentations </slightly off topic>
__________________
2010 to Present, Scorekeeper/Field Power Volunteer for FRC/FTC/FLL
2005 - 2010, Team 171 College Mentor
2002 - 2005, Team 930 Student
|