Resets during loop running

No only 8 LEDs, 4 red 4 green, then 16 of the i/o are switch inputs, 8 are relay outputs taking the relay pins to ground on arduino compatable 5v relay modules