Other Parts Discussed in Thread: EK-TM4C123GXL
Hello,
I am trying to set up a pin to be used as an input, and when it receives 5V, another pin is to be activated high and send an output.
I'm having difficulty because it seems that my input pin is being triggered without even receiving a voltage. Is there anyway to fix this?
Below is a sample of the code I use to initialize the pin:
MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
MAP_GPIOPinTypeGPIOInput(GPIO_PORTA_BASE, GPIO_PIN_6);
int limitSwitchClosed = MAP_GPIOPinRead(GPIO_PORTA_BASE, GPIO_PIN_6);
if(limitSwitchClosed)
{
do this...
}
....But is seems that even if I disconnect the wire from the limit switch, the pin gets activated. It only doesn't get activated once I completely remove any wire to that pin.
Any help would be very much appreciated!