0
votes

I'm working a little project where I make my own version of serial communication between 2 arduino megas using their digital I/O pins.

So there are a couple digital pins on arduino A that are set as output. These are plugged into two digital pins in arduino B which are set as input. Is there a way for arduino B to detect whether the output pins coming from arduino A are high or low?

I know this can be done with transistors, but is there a way to do it without them?

1

1 Answers

0
votes

The digital pins from one Arduino can be connected directly to the digital pins on the other - no need for any transistors in between. Make sure there is a common ground between them so both boards are at the same reference level (connect the GND pins, or power both from the same supply).

You can read the digital pins on the receiving end by calling digitalRead(), and write to the digital pins on the sending end by calling digitalWrite(). Whatever protocol you implement will need to detect the high/low transitions and decode them accordingly.

I guess I'm curious why you wouldn't just use the built-in serial ports to communicate, unless this is just a learning exercise? Certainly worthwhile for learning, but unnecessary extra work otherwise...