void loop()
{
myvalue = analogRead(A0);
Serial.print(myvalue);
if ((RED && RED_1)!HIGH);
{
digitalWrite(RED, HIGH);
digitalWrite(RED_1, HIGH);
}
delay(4000);
Your code is incomplete, and you didn't say what your problem is.
But karma for using code tags on your first post.
if ((RED && RED_1)!HIGH);
I have no idea what that is supposed to look like, but it should not have that semicolon
if ((RED && RED_1)!HIGH);
I suspect that this line is the problem.
Even supposing that the if command was properly constructed (probably a missing =) it ends with a semicolon so the supposed conditionally executed statements in the code block would always be executed.
if ((RED && RED_1)!HIGH);
Also, they seem to be pin numbers, so anything that compares them to HIGH is probably a mistake. digitalRead(RED) etc maybe?
If your code
if ((RED && RED_1)!HIGH);
{
digitalWrite(RED, HIGH);
digitalWrite(RED_1, HIGH);
}
is intended to mean:
if ( (RED AND RED_1) is NOT EQUAL to HIGH ) then write HIGH to outputs RED and RED_1
then even with proper syntax the statement will not work.
(RED AND RED_1) will only equal HIGH when both are HIGH.
If either, or both, are LOW, then the IF statement is true and you will write HIGH to both outputs, but in that case the IF statement is useless, because the only time you will not be writing HIGH to the outputs is when they are both already HIGH.
The other major problem is that you are not actually comparing the current state of the outputs in the IF statement, you are comparing the pin numbers assigned to RED and RED_1, so what the code is actually asking is:
IF ( (pin # assigned to RED) AND (pin # assigned to RED_1) ) NOT EQUAL to HIGH)
which will only be true if either RED or RED_1 is assigned to pin 0.