I have an odd situation that is a bit confusing.
My Seeed CAN-Bus shield (connected to an ELEGOO MEGA R3 Board ATmega 2560) is working fine in my vehicle until I define my INPUT_PULLUP pins:
pinMode(LowRange_Input, INPUT_PULLUP);
pinMode(ACRequest_Input, INPUT_PULLUP);
These pins are linked to grounded switches in the vehicle. When I comment out the pins, the CAN-Bus can read, send, and request PIDs just fine. However, whenever I enable the pins I don’t get any messages from the vehicle. It just loops here:
if (CAN_MSGAVAIL != CAN.checkReceive()) { // check if we can get data
return;
}
I had a test sketch that removes the CAN portion and the input pins work fine (it recognizes when the grounded switches are activated). I have tried to move the inputs to other pins. I tried to activate only one pin. I also tried to define as an INPUT rather than INPUT_PULLUP and the same issue occurs.
Does anyone have any ideas on how these INPUT_PULLUP pins could be interfering with the CAN-Bus signal?
Thanks!