Arduino capacitor reformer

  if (state = 1) int charge ();
  if (state = 2) int wait (hold);
  if (state = 3) int discharge ();
  if (state = 4) int saftey ();

isn't right. Are you expecting to call some functions rather than declare them?

Your code sounds like it can simply be linear and not need a state variable (or are you doing something else in the sketch at the same time?)