 TelegramReader telegramReader;
 WiFiClientSecure httpsClient;
 
+enum ErrorCode {
+  NO_ERROR = 0,
+  WIFI_CONNECT_ERROR = 1,
+  NTP_ERROR = 2,
+  TELEGRAM_READ_ERROR = 3,
+  TELEGRAM_CHECKSUM_ERROR = 4,
+  SERVER_CONNECT_ERROR = 5,
+  SERVER_SSL_ERROR = 6,
+  SERVER_READ_ERROR = 7,
+  SERVER_PROTOCOL_ERROR = 8,
+  SERVER_RESPONSE_ERROR = 9,
+};
+
 void setLed(bool on) {
   digitalWrite(LED_PIN, on ? LOW : HIGH);
+}
+
+void blinkLed(int ms) {
+  setLed(true);
+  delay(ms);
+  setLed(false);
+}
+
+/**
+ * Flashes out an error in a kind of "decimal morse code", for example:
+ * 502 = ..... _ ..
+ */
+void flashNumber(uint16 number) {
+  byte digits[5]; // Maximum 65535.
+  byte numDigits = 0;
+  while (number) {
+    digits[numDigits] = number % 10;
+    numDigits++;
+    number /= 10;
+  }
+  if (numDigits == 0) {
+    digits[0] = 0;
+    numDigits = 1;
+  }
+  while (numDigits) {
+    numDigits--;
+    setLed(false);
+    delay(500);
+
+    byte digit = digits[numDigits];
+    if (digit) {
+      while (digit) {
+        digit--;
+        blinkLed(150);
+        delay(150);
+      }
+    } else {
+      blinkLed(500);
+      delay(150);
+    }
+  }
 }
 
 /**

      "\r\n");
  httpsClient.write(buffer, size);

  Serial.print("Uploaded telegram of ");
  Serial.print(size);
  Serial.println(" bytes");

  return true;
}

    Serial.print(READ_TIMEOUT_MILLIS);
    Serial.println(" ms");
    telegramReader.reset();
    flashNumber(TELEGRAM_READ_ERROR);
  }

  int b = P1_INPUT.read();
