Arduino crashes/hangs

Hello guys,
this is my first real Arduino script so please excuse me if it's wrong.
I have the problem that as soon as I wait a few seconds the arduino does nothing and stays in the actual state where it was.
The code is for a soldering station.

#include <SPI.h>
#include <Wire.h>
#include <max6675.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 32
#define OLED_RESET     4
#define thermoDO 11
#define thermoCS 12
#define thermoCLK 13
#define potentiometer A3
#define mosfet 4
float temperature;
int pottemperature;
int millisMem;
MAX6675 thermocouple(thermoCLK, thermoCS, thermoDO);
Adafruit_SSD1306 display(OLED_RESET);

void setup() {
  pinMode(potentiometer, INPUT);
  pinMode(mosfet, OUTPUT);
  digitalWrite(mosfet, LOW);
  delay(1);
  temperature = thermocouple.readCelsius();
  delay(100);
  Serial.begin(9600);
  display.begin(SSD1306_SWITCHCAPVCC, 0x3c);
  display.display();
  display.clearDisplay();
  display.setTextSize(1);
  display.setTextColor(WHITE);
  updatedisplay();
  millisMem=millis();
  

}

void loop() {
  if (millis() -millisMem == 200) {
    digitalWrite(mosfet, LOW);
    temperature = thermocouple.readCelsius();
   if (temperature < pottemperature) {
    digitalWrite(mosfet, HIGH);
    updatedisplay();
    millisMem=millis();
    }
  else {
    digitalWrite(mosfet, LOW); 
    updatedisplay(); 
    millisMem=millis();
    }
  }
  else {}
}
void updatedisplay() {
  pottemperature = analogRead(potentiometer);
  pottemperature = map(pottemperature, 0, 1023, 0, 400);
  display.clearDisplay();
  display.setCursor(0, 0);
  display.print("Target:");
  display.print(pottemperature);
  display.setCursor(0, 20);
  display.print("Temperature:");
  display.print(int(temperature));
  display.display();
}

software.ino (1.58 KB)

Please include code using code-tags

@couka I did it now.

Variables used for timing should be declared unsigned long. An int data type can hold numbers from -32768 to 32787. How long till millis() will no longer fit in an int?

 if (millis() -millisMem == 200) {

I would use >= instead of == in case the exact 200 is missed.

millisMem should be unsigned long, not int.

Also, it's dangerous to do this:

  if (millis() - millisMem == 200)

better:

  if (millis() - millisMem >= 200)