View Single Post
  #4   Spotlight this post!  
Unread 09-03-2015, 17:12
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,112
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: Need help with logic

I'm not quite sure what the picture is supposed to show me, but I'll take a guess. Is each lift a lead screw driven by a belt from a motor?

Are all three lifts independent, or do they need to coordinate with each other somehow? I will assume that each lift works on its own.

Once the button is pressed, do you want the lift motor to continue running until the limit switch is activated, or do you want the motor to stop when the button is released? I will assume that you want the button to start the motor, and only the limit switch will stop it. (That's dangerous, but it sounds like what you asked for.)

The simple way to do it is to use a flat sequence inside a neverending while loop in Periodic Tasks. The first frame of the sequence waits for the joystick button to be pressed. The second frame sets the motor to run the lift downward. The third frame waits for the limit switch to be activated. The fourth frame stops the motor. If that's not enough of a hint, ask for more help about what you don't understand.

There should also be a failsafe in the part that waits for the limit switch. I suggest an "abort" button on the joystick that stops the lift motor on command, and also a timer that stops it if too much time has elapsed. You could also stop driving the motor if the encoder indicates that the lift has moved too far, or if it has stopped.
Reply With Quote