int timer = 1500; // the amount of time each portion of the array is on int nMosPins[] = { // location of nMOSFET pins 3,2,1,0}; int nMosCount = 4; // number of nMOSFET pins int pMosPins[] = { // location of p MOSFET pins 4,7,5}; int pMosCount = 3; // number of pMOSFET pins int ledPin = 8; void setup(){ for (int nPin = 0; nPin < nMosCount; nPin++){ //initiate nMos pins as outputs pinMode(nMosPins[nPin], OUTPUT);} for (int pPin = 0; pPin < pMosCount; pPin++){ //initiate pMos pins as outputs pinMode(pMosPins[pPin], OUTPUT); digitalWrite(pMosPins[pPin], HIGH); } pinMode(ledPin, OUTPUT); } void loop(){ for (int i = 0; i < pMosCount; i++){ digitalWrite(pMosPins[i], LOW); digitalWrite(ledPin, HIGH); for (int j = 0; j < nMosCount; j++){ digitalWrite(nMosPins[j], HIGH); delay(timer); digitalWrite(nMosPins[j],LOW); } digitalWrite(pMosPins[i], HIGH); digitalWrite(ledPin, LOW); delay(500); } }