I am trying to wire up limit switches to pwm’s so that our programmer can make it control if a solenoid can shoot or not. At the moment I have connected 2 limit switches to the front of a piece a metal so then the soccer ball hits it it will will release the soloenoid shooting out 2 pistons, this was a direct hook to the power. In turn we hooked up signal wire to the solonoids, in teleoperated mode we can manually shot off the pistons. Unfortunately the limit switches, that are now hooked to pwm ports 1 & 2, when they are tripped they do not set off the pistons, instead it resets the robot. It makes the robot glitch and move all the motors for a moment. Can anyone help me with my problem. I have tried re-wiring it but turned out to be unfruitful… :eek:
If you are shorting power to ground on the PWMs, you’re lucky if you didn’t fry your sidecar. You need to hook any inputs (like switches) up the digital inputs on the sidecar. PWMs are output only.
I hooked up the limit switch pwm to the sidecar’s digital inputs. Is there a certain port it needs to be in? I’m not sure if I wired it correctly. The code always returns the same value when its switched or unswitched.
How you hooked it up is key here. It sounds to me like you may have wired the limit switch to short power and ground - this is bad. The Digital Sidecar contains an internal pull-up resistor on the digital IO ports - this means if you send no signal to the input, it will read as if 5V was sent. See page 19 of http://usfirst.org/uploadedFiles/Community/FRC/Game_and_Season__Info/2010_Assets/3-2010FRCControlSystemComponent%20DatasheetsRev1_enc.pdf
To wire a limit switch, take a standard PWM cable and wire the Black and the White wires to the switch in your preferred method (normally closed or normally open). The method used doesn’t really matter - normally closed means you would see a 0 in the code when the switch is not pressed, a 1 when it is pressed. normally open is reverse. Do NOT hook up the red wire from the PWM. It’s not needed (due to the pull up resistor), and if you mess up your wiring you could risk shorting it. It’s better all around not to use it with the limit switches.