Digital Inputs

After a few days of frustration, I figured out what we were doing wrong with digital inputs. The digital inputs aren’t “pulled down” so they read unpredictable values. Our button makes the input read “0” when pushed, which is fine, but when it’s NOT pushed, the value fluctuates between 0 and 1. Is there any way we can make the “not pushed” value remain at a constant value?
We just have a switch hooked up to the signal and ground wires of a pwm cable.
Do we need resistors or something else?

You probably need the +5v wire connected.

what kind of switch are you using, and how many positions is it?

We got it working with a single pole, double throw switch with the Signal wire connected to the center, and the Ground and +5V on the outsides. We’d like to use a push button. However, that only has two inputs. So what I was thinking was having the pushbutton connected to Signal and +5V (or signal and Ground) and having a resistor that connects the two inputs, so when the switch is not pressed, the input reads 0, instead of the on/off flip flop it usually does. Someone in another topic suggested using a resistor, but so far I have not been able to get this working.

Your switch should probably be between Signal and Ground, with a 10k resistor between Signal and +5.

You can do it in the other direction, with the switch between Signal and +5 and the resistor between Signal and Ground, if you want.

Ah. I guess that would make sense, wouldn’t it?

Thanks. I’ll try it out on Monday.