View Single Post
  #1   Spotlight this post!  
Unread 02-15-2015, 03:58 PM
PredaFran PredaFran is offline
Amateur Programmer
AKA: Francisco
FRC #5285 (Sea Kings Robotics)
Team Role: Programmer
 
Join Date: Jan 2015
Rookie Year: 2015
Location: California
Posts: 25
PredaFran is an unknown quantity at this point
Limit switch help

im trying to create a code that needs to stop a motor from moving and move it backwards for a short time, when a limit switch is pressed, first we are trying to start a motor using a limit switch, but we cant, any help is appreciated.




Code:
#include "WPILib.h"


class Robot: public SampleRobot
{
	Talon Motor;
    DigitalInput limitSwitch;


public:
	 Robot():

	limitSwitch(1),
	Motor(6)

	{

	}


	void OperatorControl()
	{
		while (IsOperatorControl() && IsEnabled())
		{

			if(limitSwitch.Get()>0)
            {

         			
			Set.Motor(1.5,0);

            }
        }
	}

};

START_ROBOT_CLASS(Robot);
Reply With Quote