My team is constructing an off season robot that is using one of our old control systems. I have everything programmed and working except i'm having troubles with the digital inputs. I need to read pressure sensors, and i cant get the digital inputs to change via the pressure switch or any manual switch. I'm printing the digital input and it is stuck at 1. Is it 1 by default? any suggestions for testing? or am i missing something completely? its been a awhile since i have done anything with the old FRC so maybe i have just forgot something.
Here is a link to the doc at IFI:
State of the input is based on which one you are looking at…
Hope this helps…
The default code contains an example of how to control a compressor on relay8 using the pressure switch on dig_in18, so take a look at that first for an example on reading digital inputs.
–Make sure you have digital_io_18 set to input
–Try a different input, in case the one you’re using is broken
–The inputs have pull-ups enabled, so they’re naturally high by default. The pressure switch should be connected so that it is pulling the input low, i.e. the switch is connected between the signal line and ground.
It is possible that your code is correct, but the pressure switch is not working properly… not likely, perhaps… but possible.
Have you tried checking the pressure switch with an ohmmeter to see if the contacts are closing and opening?
Alternatively, have you tried hooking up a switch (or just using jumpers) on the i/o pin to see if your code can read a “known good” switch?
You probably have, but just thought I’d add a “check the hardware” comment in amongst all the helpful software advice.
If you are sure that the switch is working (by using a multimeter) and you are sure your code is correct (by using the default code or code tested by another team), then you should check for metal chips in/around/under the input pins. I’ve seen metal chips create a short that causes all pins to pull high or low, which makes the input “stuck” either on or off.
To be sure, you are using a pressure switch and not a pressure transducer? Both were provided as KOP supplies in some of the past years. The transducer is an analog device, while the pressure switch is a just that and is connected to a digital input. Using a PWM cable, you cut off the connector at one end, pulled back the 5 volt wire and insulated it, then attached the signal and the ground wire of the PWM cable to the switch.