Send a boolean to another Arduino

Hello folks,

I have a simple question, which I am not able to answer.

Let's say I have a simple if condition on Arduino A. If this if-condition is true, then I want to send a logical 1 to Arduino B, which I tried to do with digitalWrite(8, HIGH); on Arduino A and int value = analogRead(A0); on B. So I connected the digital Pin 8 of Arduino A with A0 of Arduino B.

I expected to get 0 if the condition is false and 1023 if its correct. Am I doing something wrong? Or is the complete concept not possible? I know there is also the option to use Serial or I2C, but I have three Arduinos to connect and I want to keep it as simple as possible this time.

Thank you in advance.

Best, Nader

Have you got the Arduinos' grounds joined together?

Hey, thank your for your answer. It worked with the connected ground.

Can you explain me the electrical effect, which was causing either the not working or working case?

Thank you :)

When you have a wire on Arduino A, Arduino A knows it's at at 5V, since it'smeasured against A's ground of 0, but Arduino B has no way of knowing that unless you give B the same zero reference as A.

When you test a battery with your voltmeter you have to stick a meter wire to each end of the battery.... If you only put the red wire to the +ve end of the battery, there's no zero to measure against.

It's like the sound of one hand clapping.

@naderk, there is no need to use an analog input on Arduino B. You can detect the HIGH or LOW with digitalRead() on any of the I/O pins. Also, digitalRead() works on the analog pins.

...R

Thank you both :)