How would you do a limit switch on the Robo-Rio, I know you need to wire it into the PWM, but positive to GND or Signal? And for code do you define the PWM port? For If checks is it just If(Limitswitch_PWM_0 == true)?
A google search on “frc limit switch wiring” yields several useful sources.
Generally, switches do not have polarity, so “positive” does not mean anything. One terminal of the switch goes to Signal and the other goes to GND.
Look at one of the references you’ll find for programming help.
Also, don’t neglect mechanical design of your limit switch’s mounting and of the thing it contacts to open or close. The latter is referred to as “the flag” and it should be designed to wipe the switch, not crash into it.
You’re also able to wire them directly into some motor controllers
I’ve not heard of limit switches being used on PWM ports, in fact I’ve never heard of PWM ports being used as inputs (nor did I think possible, someone feel free to correct me here).
With that in mind, I would plug them into one of the Digital Input/Output (DIO) ports, then in code configure it as an input and check it.
Create as
DigitalInput di = new DigitalInput(<port>);
Check with
if(di.get()) {
//code
}
Make sure you’re wiring the switch to one of your DIO ports on the Rio. The PWM ports are for data output only.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.