I'm having trouble with my digital input when connecting an external power supply.
When I connect the USB first and then connect the external power supply afterwards everything works like it should. I can read my button press like normal. Unfortunately this doesn't work the other way around. When I only connect the external power supply, my button reads HIGH all the time. I tested the button and it is not shorted, it reads HIGH when there is nothing plugged in as well. This also happens when I plug in the external power supply first and then the USB afterwards.
To simplify a bit:
USB then Ext. PS -> Works
Ext. PS only -> Does not work
Ext. PS then USB -> Does not work
I'm at a complete loss, I've tried several other channels with no success. I've tried both with and without a pull-down resistor on the button, so it's not that it's unstable. I really need it to work when I plug in only the external power supply.
Assuming you are using the digital channels of the INDIO, can you try the following: when initialising the channel, first set it as OUTPUT and write LOW to it, then change to INPUT. E.g. for channel 1:
Indio.digitalMode(1, OUTPUT); // Clear CH1 to LOW
Indio.digitalWrite(1, LOW); // Clear CH1 to LOW
Indio.digitalMode(1, INPUT); // Set CH1 as an input
Please let us know if this solves it.
Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!