PDA

View Full Version : Where switches & sensors go?


DRH2o
01-13-2006, 10:01 PM
In easy c where should the limit switches be placed ? Should they be in Initialize, Autonomous, or Operator Control ? Where does the pressure switch for the compressor and the relay go? These need to be active any time the robot is active so do they go in each section as needed? In the limit switch test file it is in the Main section but you cannot place it there while using the Competition Project.

BradAMiller
01-14-2006, 07:02 AM
In easy c where should the limit switches be placed ? Should they be in Initialize, Autonomous, or Operator Control ? Where does the pressure switch for the compressor and the relay go? These need to be active any time the robot is active so do they go in each section as needed? In the limit switch test file it is in the Main section but you cannot place it there while using the Competition Project.
Good questions.

You can place code for the limit switches any place a mechanism, like an arm, is operating that needs to be protected by that limit switch. I'd suggest writing an function that operates the arm or whatever thing has the limit switch on it. Then you can call the function from Autonomous or OperatorControl. That way the code won't be duplicated.

You can write the Autonomous and OperatorControl functions as infinte loops, polling inputs and running motors. EasyC will automatically take the program out of your Autonomous function when the field switches, and put it into the OperatorControl function.

Same with the compressor, you could write a function that runs the "polls" the pressure switch and turns the compressor on or off as needed. You would call this function periodically in Initialize, Autonomous, and OperatorControl. I know that this is inconvenient, and we are hoping to incorporate a better solution for the compressor shortly in an update.

Brad

DRH2o
01-14-2006, 08:00 AM
Thanks Brad.

I will pass this on to our programmer. He is trying to decide whether he wants to use easy c or mplab. We were able to be somewhat successful last year in autonomous ( scoring about 75% of the time ) but did not use the camera or other sensors. This would be easy to do in easy c.