Basically, the problem is that I have 2 Arduino uno's and I wanted to insert a digitalwrite pin HIGH output from one Arduino into another Arduino where the digital pin is INPUT digitalwrite LOW.
Sure thanks man. I actually just wanted to send a signal into my second arduino to apply a command using if statement when the input is read. However, but I noiced it kept going randomly high by it and that triggered my relay.
this is the code which controls the relays by recieving a signal
Arduino 2
pinMode(5, INPUT); // SMS from internet check
pinMode(6, INPUT); // SMS from internet check
if (digitalRead(6)==HIGH) {
pinMode(9, OUTPUT);
digitalWrite(outputnine,HIGH);
Serial.print(" relay is off ");
delay(8000);
}
if (digitalRead(5)==HIGH){ // SMS from internet check connected to 5 in control //on
pinMode(9, OUTPUT);
digitalWrite(outputnine,LOW);
Serial.print(" relay is on ");
delay(8000);
}
}
and this the other part of the code from the first arduino that sends the signal
Arduino 1
#define outputfive 5 //Relay Command through SMS to internetcheck ON
#define outputsix 6 //relay Command through SMS to internetcheck OFF
void loop(){
pinMode(5, OUTPUT); // SMS from internet check
pinMode(6, OUTPUT); // SMS from internet check
digitalWrite(5, LOW);
digitalWrite(6, LOW);
Thanks for the help jfjlaros.
the code doesn't stay on LOW, it keeps randomly going HIGH and trigger the relays by it self.
A schematic would help. For example, are you running a single wire between Arduinos? They need to share a ground as well, or the signal will be unreferenced, and vary randomly.
C
You read inputs and write outputs. The processor determines the output state and something else (sometimes another processor) determines the input state.
Inputs go to outputs. ...Your ear is an input and your mouth is an output.
And just like you can have may people listening to one talker, you can have one output going to many inputs and the means the inputs are "shorted" (connected) together with that one output and that's OK .
But you can't have multiple talkers at the same time or multiple outputs connected together into one (or more) inputs. If you "short" outputs together and one tries to go high while high the other tries to go low, they will "fight" and the chip will overheat and it might burn-up. (And the result of this "fight" might be a voltage somewhere in-between high & low.)
Yeah, I shared ground between them. I can control it if I sent a signal ,but the input doesn't stay stable all the time low. So I cannot use it properly.
I like your profile picture. Man, this is too philosophical for my simple understanding. What I understood is output where your send signals and input where you receive them. The problem is that I tried to push a low signal into a specific input. Hoping it stays low till I use the same output to High. All that using the same wire. but the input doesn't stay all the time LOW even though I set the output to that input LOW
regarding the power, I am using 12v on the sending Arduino and 5v with the receiving Arduino/Ethernet shield. It heats up really bad whenever I try to go higher than 9 volts. I am trying to avoid burning it out.
Your use of input vs output is...interesting.
Connect one output directly to one input. Define the one output as output. Define the one input as input. Pullups irrelevant, if an active output is sending 1 or 0 the input it is wired to is going to see 1 or 0. End of story. If that isn't happening, revisit all the possible issues I outlined above. This isn't rocket science, you either have
I don't understand what possibly can go wrong programming-wise. I set one as an input that reads the output. The other one as an output LOW.
show the input should stay always LOW unless I activated a command to make it HIGH ,but that is not what is happenning. I am suspecting there is something about the ethernet shield disturbing my code. I am not sure. the only thing I can do now is what you suggested camsysca. I'll check the connections of the wires. I don't know what can I do with the program.
The last thing I thought of is, setting that input to LOW to double sure it is always LOW, but I am afraid if the input was low and i sent a high signle into it. will it short out the Arduino ?