Arduino Code for Inverter

int MOSFET1 = 5; //MOSFET1 connected to pin 

int MOSFET3 = 10; //MOSFET3 connected to pin 

int MOSFET5  = 11; //MOSFET3 connected to pin 

 

int MOSFETarray [] = {0, 32, 71, 89, 140, 160, 214, 226, 270, 296, 335, 367, 392, 439, 461, 519, 523, 572, 590, 636, 666, 697, 739, 761, 818, 821, 876, 886, 938, 963, 999, 1036, 1063, 1115, 1125, 1178, 1181, 1238, 1262, 1304, 1335, 1363, 1409, 1427, 1478, 1482, 1540, 1560, 1607, 1632, 1666, 1705, 1731, 1773, 1785, 1839, 1861, 1912, 1930, 1967, 2000};

 

void setup() {

  // put your setup code here, to run once:

pinMode(MOSFET1, OUTPUT); //sets digital pin  as output

pinMode(MOSFET3, OUTPUT); //sets digital pin  as output

pinMode(MOSFET5, OUTPUT); //sets digital pin  as output

}

 

void loop() {

  // put your main code here, to run repeatedly:

//before end of blue line

//MOS3 ON

digitalWrite(MOSFET1, LOW); //MOSFET1 off

digitalWrite(MOSFET5, LOW); //MOSFET5 off

digitalWrite(MOSFET3, HIGH); //MOSFET3 on

delayMicroseconds(MOSFETarray[1]*10);

//MOS3 OFF

digitalWrite(MOSFET3, LOW);

delayMicroseconds((MOSFETarray[2]-MOSFETarray[1])*10);

//MOS3 ON

digitalWrite(MOSFET3, HIGH); 

delayMicroseconds((MOSFETarray[3]-MOSFETarray[2])*10);

//MOS1 ON

digitalWrite(MOSFET1, HIGH);

delayMicroseconds((MOSFETarray[4]-MOSFETarray[3])*10);

//MOS5 ON

digitalWrite(MOSFET5, HIGH);

delayMicroseconds((MOSFETarray[5]-MOSFETarray[4])*10);

//MOS5 OFF

digitalWrite(MOSFET5, LOW);

delayMicroseconds((MOSFETarray[6]-MOSFETarray[5])*10);

//MOS3 OFF

digitalWrite(MOSFET3, LOW);

delayMicroseconds((MOSFETarray[7]-MOSFETarray[6])*10);

//MOS1 OFF

digitalWrite(MOSFET1, LOW); 

delayMicroseconds((MOSFETarray[8]-MOSFETarray[7])*10);

 

//second

//MOS1 ON

digitalWrite(MOSFET1, HIGH);

delayMicroseconds((MOSFETarray[9]-MOSFETarray[8])*10); 

//MOS3 ON

digitalWrite(MOSFET3, HIGH); 

delayMicroseconds((MOSFETarray[10]-MOSFETarray[9])*10);

//MOS5 ON

digitalWrite(MOSFET5, HIGH);

delayMicroseconds((MOSFETarray[11]-MOSFETarray[10])*10);

//MOS5 OFF

digitalWrite(MOSFET5, LOW);

delayMicroseconds((MOSFETarray[12]-MOSFETarray[11])*10);

//MOS3 OFF

digitalWrite(MOSFET3, LOW);

delayMicroseconds((MOSFETarray[13]-MOSFETarray[12])*10);

//MOS1 OFF

digitalWrite(MOSFET1, LOW);

delayMicroseconds((MOSFETarray[14]-MOSFETarray[13])*10);

 

//third

//MOS1 ON

digitalWrite(MOSFET1, HIGH);

delayMicroseconds((MOSFETarray[15]-MOSFETarray[14])*10);

//MOS5 ON

digitalWrite(MOSFET5, HIGH);

delayMicroseconds((MOSFETarray[16]-MOSFETarray[15])*10);

//MOS3 ON

digitalWrite(MOSFET3, HIGH); 

delayMicroseconds((MOSFETarray[17]-MOSFETarray[16])*10);

//MOS3 OFF

digitalWrite(MOSFET3, LOW);

delayMicroseconds((MOSFETarray[18]-MOSFETarray[17])*10);

//MOS5 OFF

digitalWrite(MOSFET5, LOW);

delayMicroseconds((MOSFETarray[19]-MOSFETarray[18])*10);

//MOS1 OFF

digitalWrite(MOSFET1, LOW); 

delayMicroseconds((MOSFETarray[20]-MOSFETarray[19])*10);

 

//fourth

//MOS1 ON

digitalWrite(MOSFET1, HIGH);

delayMicroseconds((MOSFETarray[21]-MOSFETarray[20])*10);

//MOS5 ON

digitalWrite(MOSFET5, HIGH);

delayMicroseconds((MOSFETarray[22]-MOSFETarray[21])*10);

//MOS3 ON

digitalWrite(MOSFET3, HIGH); 

delayMicroseconds((MOSFETarray[23]-MOSFETarray[22])*10);

//MOS3 OFF

digitalWrite(MOSFET3, LOW);

delayMicroseconds((MOSFETarray[24]-MOSFETarray[23])*10);

//MOS5 OFF

digitalWrite(MOSFET5, LOW);

delayMicroseconds((MOSFETarray[25]-MOSFETarray[24])*10);

//MOS1 OFF

digitalWrite(MOSFET1, LOW); 

delayMicroseconds((MOSFETarray[26]-MOSFETarray[25])*10);

 

//fifth

//MOS5 ON

digitalWrite(MOSFET5, HIGH);

delayMicroseconds((MOSFETarray[27]-MOSFETarray[26])*10);

//MOS1 ON

digitalWrite(MOSFET1, HIGH);

delayMicroseconds((MOSFETarray[28]-MOSFETarray[27])*10);

//MOS3 ON

digitalWrite(MOSFET3, HIGH); 

delayMicroseconds((MOSFETarray[29]-MOSFETarray[28])*10);

//MOS3 OFF

digitalWrite(MOSFET3, LOW);

delayMicroseconds((MOSFETarray[30]-MOSFETarray[29])*10);

//MOS1 OFF

digitalWrite(MOSFET1, LOW); 

delayMicroseconds((MOSFETarray[31]-MOSFETarray[30])*10);

 

//sixth

//MOS5 OFF

digitalWrite(MOSFET5, LOW);

delayMicroseconds((MOSFETarray[32]-MOSFETarray[31])*10);

//MOS5 ON

digitalWrite(MOSFET5, HIGH);

delayMicroseconds((MOSFETarray[33]-MOSFETarray[32])*10);

//MOS1 ON

digitalWrite(MOSFET1, HIGH);

delayMicroseconds((MOSFETarray[34]-MOSFETarray[33])*10);

//MOS3 ON

digitalWrite(MOSFET3, HIGH); 

delayMicroseconds((MOSFETarray[35]-MOSFETarray[34])*10);

//MOS1 OFF

digitalWrite(MOSFET1, LOW); 

delayMicroseconds((MOSFETarray[36]-MOSFETarray[35])*10);

 

//seventh

//MOS3 OFF

digitalWrite(MOSFET3, LOW);

delayMicroseconds((MOSFETarray[37]-MOSFETarray[36])*10);

//MOS5 OFF

digitalWrite(MOSFET5, LOW);

delayMicroseconds((MOSFETarray[38]-MOSFETarray[37])*10);

//MOS5 ON

digitalWrite(MOSFET5, HIGH);

delayMicroseconds((MOSFETarray[39]-MOSFETarray[38])*10);

//MOS3 ON

digitalWrite(MOSFET3, HIGH); 

delayMicroseconds((MOSFETarray[40]-MOSFETarray[39])*10);

//MOS1 ON

digitalWrite(MOSFET1, HIGH);

delayMicroseconds((MOSFETarray[41]-MOSFETarray[40])*10);

//MOS1 OFF

digitalWrite(MOSFET1, LOW); 

delayMicroseconds((MOSFETarray[42]-MOSFETarray[41])*10);

 

//eighth

//MOS3 OFF

digitalWrite(MOSFET3, LOW);

delayMicroseconds((MOSFETarray[43]-MOSFETarray[42])*10);

//MOS5 OFF

digitalWrite(MOSFET5, LOW);

delayMicroseconds((MOSFETarray[44]-MOSFETarray[43])*10);

//MOS5 ON

digitalWrite(MOSFET5, HIGH);

delayMicroseconds((MOSFETarray[45]-MOSFETarray[44])*10);

//MOS3 ON

digitalWrite(MOSFET3, HIGH); 

delayMicroseconds((MOSFETarray[46]-MOSFETarray[45])*10);

//MOS1 ON

digitalWrite(MOSFET1, HIGH);

delayMicroseconds((MOSFETarray[47]-MOSFETarray[46])*10);

//MOS1 OFF

digitalWrite(MOSFET1, LOW); 

delayMicroseconds((MOSFETarray[48]-MOSFETarray[47])*10);

 

//NINTH

//MOS5 OFF

digitalWrite(MOSFET5, LOW);

delayMicroseconds((MOSFETarray[49]-MOSFETarray[48])*10);

//MOS3 OFF

digitalWrite(MOSFET3, LOW);

delayMicroseconds((MOSFETarray[50]-MOSFETarray[49])*10);

//MOS3 ON

digitalWrite(MOSFET3, HIGH); 

delayMicroseconds((MOSFETarray[51]-MOSFETarray[50])*10);

//MOS5 ON

digitalWrite(MOSFET5, HIGH);

delayMicroseconds((MOSFETarray[52]-MOSFETarray[51])*10);

//MOS1 ON

digitalWrite(MOSFET1, HIGH);

delayMicroseconds((MOSFETarray[53]-MOSFETarray[52])*10);

//MOS1 OFF

digitalWrite(MOSFET1, LOW); 

delayMicroseconds((MOSFETarray[54]-MOSFETarray[53])*10);

 

//TENTH

//MOS5 OFF

digitalWrite(MOSFET5, LOW);

delayMicroseconds((MOSFETarray[55]-MOSFETarray[54])*10);

//MOS3 OFF

digitalWrite(MOSFET3, LOW);

delayMicroseconds((MOSFETarray[56]-MOSFETarray[55])*10);

//MOS3 ON

digitalWrite(MOSFET3, HIGH); 

delayMicroseconds((MOSFETarray[57]-MOSFETarray[56])*10);

//MOS1 ON

digitalWrite(MOSFET1, HIGH);

delayMicroseconds((MOSFETarray[58]-MOSFETarray[57])*10);

//MOS5 ON

digitalWrite(MOSFET5, HIGH);

delayMicroseconds((MOSFETarray[59]-MOSFETarray[58])*10);

//MOS5 OFF

digitalWrite(MOSFET5, LOW);

delayMicroseconds((MOSFETarray[60]-MOSFETarray[59])*10);

}