Hi all,
I am in urgent need to make a sketch that can take an output of a pulse timer and create two outputs
One high and one low..
The outputs need to be opposite all the time
If the output goes
Input Low, output1 high, output2 low
Input High, output1 low, output2 high
The pulse timer output is ready for Arduino..
Can someone please help..
Cheers shaun
toxsickcity:
If the output goes
Input Low, output1 high, output2 low
Input High, output1 low, output2 high
That is very nearly the code right there... and this is a bit closer:
If ( the output goes Input Low )
{
output1 high, output2 low
}else
{
// Input High,
output1 low, output2 high
}
Yours,
TonyWilk
Do you need to make sure that the two outputs are NEVER on at the same time, even for a few microseconds (like in an h-bridge to prevent shoot through)?
Isn't a 74HC04 easier?
One inverter for output 1, two inverters in series for output 2. Done. And you use only half of that IC.
wvmarle:
Isn't a 74HC04 easier?
One inverter for output 1, two inverters in series for output 2. Done. And you use only half of that IC.
Yes, that'd work and prevents the possibility of both drivers turning ON when the Arduino is not controlling the pins (e.g. during 'boot') or when you get the code wrong 
With the right circuit, two output pins on your Arduino give you the options of:
// always turn drivers off first, so they're never on together
If ( the output goes Input Low )
{
output2 LOW then output1 HIGH
}else
{
// Input High,
output1 LOW then output2 HIGH
}
and, of course:
output1 LOW, output2 LOW // turn 'em both off
Yours,
TonyWilk
Sometimes the code is simpler than I think it needs to be! Haha
So I'd need to assign input, output1 and output2 to pins
Also I don't get the last line.. turn them both off?
Thanks fellas.
toxsickcity:
Also I don't get the last line.. turn them both off?
You didn't say much about what this is for so I simply mentioned that your code could turn both outputs off if it ever needed to.
If the only thing this circuit ever needed to do was HIGH/LOW or LOW/HIGH then wvmarle's suggestion of using a 74HC04 would be a lot simpler.
Yours,
TonyWilk