I have a question. I have 2 same boards Arduino Mega and I need to interconnect couple digital signals to use as permission for some logical routines. What is the best way to connect them? First of all I need to make common ground, that is basic and logical. I'm looking for any other hidden things that I'm now aware of.
I could have straight connection between output and input, but I shouldn't do it. As I understood from other threads that I need to use resistor between pins but I can't find what capacity it should be.(picture from internet) What resistor capacity should I use in this case?
It's OK to directly connect an input & output. It's also OK to connect two inputs together and since the I/O pins default to input everything is safe before & while initializing.
Connecting two outputs together is BAD because if one writes low and the other writes high you will get excess current and stress both devices.
A 1K resistor will limit current and it will be safe under any situation without affecting anything. If the resistor is too high in value the input becomes more sensitive to noise so it would depend on how electrically-noisy your environment is.
connection between 2 outputs by default is bad
Thank you for the reply. I will use 1K resistor as you suggested. I know that connection between input and output without resistor will works and it's fine, but I want to protect the connection at least a little bit.
Should I wary if I use RX/TX pins as outputs/inputs and should I serve them differently?
Do NOT use your RX/TX lines for anything - they're used in the Serial Monitor, and are too useful there. By all means use the other serial port lines, I'm just talking about RX/TX, the first pair.
C
Hi Yuri - if the signals are ALWAYS constant there is no problem. If they can change then you may need to think about "handshaking". This is a good example
Basically, how wiill board "B" know that the data from board "A" is stable and valid?
My first pair of RX/TX communication will be occupied for serial communication between other boards. I won't be using first pair of serial communication pins for any digital signals.
it's more expesive handshaking communication. I use this methodology always in our industrial equipment to protect and validate commands, statuses, etc. For my application it's slight overkill and will take extra pins that I don't want to.