02-07-2020 03:54 PM
Hello! I've been trying to program a limit switch for my robot for awhile in order to clasp a pole when pressed. How can I call a motor when the limit switch is pressed for a specified period of time? How would one program this in the Begin, Teleop, and Finish? Thanks!
02-08-2020 09:05 AM - edited 02-08-2020 09:09 AM
use Begin to initialize everything
Use Teleop or Periodic Tasks to code the action - since this would be easier to code as "waiting" for the condition, this might be better for periodic tasks (so the drive code in teleop is unaffected by the loop).
If you need more control than the flat sequence gives you (which is likely), consider building a State Machine (so you can code each part of it, waiting, pressed, closing, etc in discreet parts and move from one to the next or start over easily)
In Finish, close all the IO you opened in Begin.
If you have any questions about this (or LabVIEW for FRC in general), please feel free to PM me.