How to properly reverse DC motor direction with 2 limit switchws
void loop() {
  tilt_up();
}

void tilt_up()
{
...
  if (digitalRead(sw2State == LOW)) {
    tilt_down();
...
  }
}

...

void tilt_down()
{
...
  if (digitalRead(sw3State == LOW)) {
    tilt_up();
...
  }
 }


You are recursing here. loop calls tilt_up which eventually calls tilt_down which calls tilt_up and so on until you - rather quickly - run out of RAM.

Rewrite so that you are not doing that.



Also see what @MikaelPatel told you in your other question. You have the brackets in the wrong place.

  if (digitalRead(sw2State == LOW)) {


should be:

  if (digitalRead(sw2State) == LOW) {