Go Down

Topic: Digitally ANDing to output pins and putting the result on third output pin (Read 358 times) previous topic - next topic

alanj100

I have two out put pins from the Arduino UNO connected to a 74hc00 and gat chip and am using the resulting output signal


Is there any way I can Digitally AND to output pins  and putting the result on third output pin? and get rid of my 74hc00 chip

PaulS

Quote
Is there any way I can Digitally AND to output pins
No, but you can and two output values, and set one pin appropriately.
The art of getting good answers lies in asking good questions.

Jiggy-Ninja

Do you still need the original two outputs?

There is no way to gate two pins in hardware, but this is a very easy task to do in software.
Hackaday: https://hackaday.io/MarkRD
Advanced C++ Techniques: https://forum.arduino.cc/index.php?topic=493075.0

Montmorency

Is there any way I can Digitally AND to output pins  and putting the result on third output pin? and get rid of my 74hc00 chip
What does "digitally" stand for in this context? If you want to "get rid of 74hc00 chip", then you should simply do that AND in software, on the Arduino side. But this is trivial. And it is not clear whether this is what your question is about.

MorganS

Code: [Select]
 digitalWrite(pinC, pinAValue && pinBValue);

Of course ABC are poor names. These variables should be named according to what is in them. "motorPin" or "redLEDPin" or...
"The problem is in the code you didn't post."

UKHeliBob

Code: [Select]

if (variable1 == HIGH && variable2 == HIGH)
  {
    digitalWrite(outPin, HIGH);
  }
else
  {
    digitalWrite(outPin, LOW);
  }
Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

neiklot

Your question is very similar to your other thread, but this one doesn't mention pwm. You didn't even reply in your other thread.

I wonder if this is an xy problem? What is it that you actually want to do?




alanj100

HI just tried
 if (LED2 ==HIGH && Sol3 ==HIGH);
      {
        digitalWrite(And,HIGH);
      }
      else
      {
      digitalWrite(And, LOW);
    }


and get error  else without a prvious if

neiklot


alanj100


neiklot

BRILLIANT Thanks I'll remember that one
Don't worry, there are plenty of other things that will get you in the future too, rest assured....

Still keen to understand the relationship between this thread and the other which is about PWM....


alanj100

Basicaly I have a pin(PWM) that delivers pwm and I have a pin (EN) that cycles high low. I want to And them together so I only get pulses when the EN pin is high.
I'm using an AND gate at the moment and that works great.
I can compile the code now but it's not doing what I thought it would no. It's just saying low.
I'm geting about 20 pulses when EN pin is high so it should work


alanj100

It's working now. Had to slightly alter the code:

digitalRead (Add) == HIGH && digitalRead (LED1)== HIGH)
Thanks for your help

UKHeliBob

Quote
I have a pin(PWM) that delivers pwm and I have a pin (EN) that cycles high low. I want to And them together so I only get pulses when the EN pin is high.
Why AND them together ?
Code: [Select]


if digitalRead(enPin) == HIGH)
  {
    analogWrite(pwmPin, someValue);
  }
else
  {
    analogWrite(pwmPin, 0);
  }


Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

Go Up