Running code on two Uno's

I had previously posted this message, got some helpful information and it appeared to work exactly 1 time.

I am attempting to have Uno 1 to control code on Uno 2. I have a ground wire going from Uno 1 to Uno 2. On Uno 1, I have set up pin 8 to OUTPUT and I've connected pin 8 on 1 to pin 2 on Uno 2. On Uno 2, I have setup pin 2 to INPUT_PULLUP.

When I want the code to run Uno 2, I digitalWrite pin 8 to HIGH or LOW depending what I need to happen. I have confirmed that pin 8 on Uno 1 goes HIGH or LOW as required.

I believe that when pin 8 on Uno 1 goes HIGH, pin 2 on Uno 2 should go LOW but it doesn't, pin 2 on Uno 2 remains HIGH regardless of the status of pin 8 on Uno 1.

I'm obviously missing something but I don't know what it is.

Any suggestions would be appreciated. Thank you.

Post the code, using code tags (as described in the "How to use this forum" post).

I believe that when pin 8 on Uno 1 goes HIGH, pin 2 on Uno 2 should go LOW

Why would you think that ?

Having Uno 1 set its pin 8 HIGH and passing that to pin 2 on Uno 2 is the same as taking pin 2 on Uno 2 HIGH directly. However, as you are using INPUT_PULLUP it will already be HIGH. I suggest that you use INPUT on pin 2 of Uno 2 and let Uno 1 take charge of its state.

How are you monitoring the state of pin 2 on Uno 2 ?

On Uno 1, I have set up pin 8 to OUTPUT and I've connected pin 8 on 1 to pin 2 on Uno 2.

If pin 8 on Uno 1 goes HIGH, then pin 2 on Uno 2 should go HIGH (how can there be different voltages on the two ends of your wire?). If pin 8 on Uno 1 goes LOW, then pin 2 on Uno 2 should go LOW.

It seems as if your wire has gotten disconnected or perhaps broken. Check your wiring.

By the way, once you get this working, you can change the pin mode of pin 2 from INPUT_PULLUP to INPUT. INPUT_PULLUP here is unnecessary but harmless.

UKHeliBob:
However, as you are using INPUT_PULLUP it will already be HIGH.

I think not. I believe that the active pull down Uno 1’s output stage (when LOW) will be much stronger than the PULLUP resistor on Uno 2’s input.

gfvalvo: I think not. I believe that the active pull down Uno 1's output stage (when LOW) will be much stronger than the PULLUP resistor on Uno 2's input.

A quick test proves that you are correct

It was a faulty wire between pin 8 on Uno 1 and pin 2 on Uno 2.

Thanks to all for your suggestions.