Capacitive Touch Lamp - Mode Problems

There is a difference between using single = and double ==
A single one will assign a value to mode and a double will check the value against mode. Your code is correct for mode 4 but the others are wrong.

  if (mode = 0) analogWrite(LEDPin, 0);
  if (mode = 1) analogWrite(LEDPin, 100);
  if (mode = 2) analogWrite(LEDPin, 150);
  if (mode = 3) analogWrite(LEDPin, 254);
  if (mode == 4) mode = 0; //If the value for mode is equal to 4 then set value of mode to 0.

Once you get this working okay it might be nice to add code to ramp the brightness up to the next level instead of doing an instant change in brightness.