I am doind a DC-AC inverter, and i need to toggle two pins at the same time, but i need a 1us accuracy, but for example, there is a 3us delay between a HIGH and a LOW for Q1 and Q2, thar are always complementary. This is my code:
//Primer semiciclo
//2)Q1 y Q4
digitalWrite(Q2,LOW); digitalWrite(Q3,LOW); //Q2 y Q3 apagado
//delayMicroseconds(td); //Tiempo muerto
digitalWrite(Q1,HIGH); digitalWrite(Q4,HIGH); //Q1 y Q4 ENCENDIDO
delayMicroseconds(duty); //Duracion del semiciclo (T/4)
//1)Q2 y Q4
digitalWrite(Q3,LOW); digitalWrite(Q1,LOW); //Q1 y Q3 apag