Quote:
Originally Posted by Roger
Currently I'm getting a semi-random highs/lows, even without pressing the button...
|
This sounds VERY much like your pin is floating. This is not really a programming issue, but a wiring/electrical issue.
Watch this video,
note why he uses the resistor. If you get it, good, otherwise, I'll explain:
Originally Posted by Roger
But aren't they both using an on/off electical signal to talk between them? Not code.
Yes and no. The cRIO will send out an on/off electrical signal, but the Arduino DIO pin does not "sense" "on or off." It senses 5v or Ground. If you hook it up to nothing (what you may call "off"), it will basically sense the voltage of the wire/air that it is connected to. Ever looked at a volt meter when you haven't yet hooked it up to a power source? It wanders all over the place. This is what your Arduino DIO pin is doing. It could be anything, high or low. You need to use a resistor to specifically connect the DIO pin to Ground when it isn't sensing a 5v from the cRIO DIO pin. This is called using a
pull-down resistor (not to be confused with a pull-up resistor, but similar idea).
Do you have a mentor who is an electrical engineer or knows electronics? You should have him help you out. This concept is a little tricky, it took me a while to figure out. Before that I was thinking the same as you.