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
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
Is there any way I can Digitally AND to output pins
No, but you can and two output values, and set one pin appropriately.
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.
alanj100:
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.
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...
if (variable1 == HIGH && variable2 == HIGH)
{
digitalWrite(outPin, HIGH);
}
else
{
digitalWrite(outPin, LOW);
}
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?
HI just tried
if (LED2 ==HIGH && Sol3 ==HIGH);
{
digitalWrite(And,HIGH);
}
else
{
digitalWrite(And, LOW);
}
and get error else without a prvious if
Lose the ; after the ) of the if
BRILLIANT Thanks I'll remember that one
alanj100:
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....
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:
I can compile the code now
What code would that be?
It's working now. Had to slightly alter the code:
digitalRead (Add) == HIGH && digitalRead (LED1)== HIGH)
Thanks for your help
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 ?
if digitalRead(enPin) == HIGH)
{
analogWrite(pwmPin, someValue);
}
else
{
analogWrite(pwmPin, 0);
}
UKHeliBob:
if (variable1 == HIGH && variable2 == HIGH)
{
digitalWrite(outPin, HIGH);
}
else
{
digitalWrite(outPin, LOW);
}
There is also the single-line version, and reading the actual state of the output pins:
digitalWrite(pinC, ((digitalRead(pinA) == HIGH && digitalRead(pinB) == HIGH) ? HIGH : LOW));
Why the need to read the state of 2 pins ?
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