     display->drawString(0 + x, 34 + y, "Arial 24");
 }
 
+String urlencode(String str)
+{
+    String encodedString="";
+    char c;
+    char code0;
+    char code1;
+    char code2;
+    for (int i =0; i < str.length(); i++){
+        c=str.charAt(i);
+        if (c == ' '){
+            encodedString+= '+';
+        } else if (isalnum(c)){
+            encodedString+=c;
+        } else{
+            code1=(c & 0xf)+'0';
+            if ((c & 0xf) >9){
+                code1=(c & 0xf) - 10 + 'A';
+            }
+            c=(c>>4)&0xf;
+            code0=c+'0';
+            if (c > 9){
+                code0=c - 10 + 'A';
+            }
+            code2='\0';
+            encodedString+='%';
+            encodedString+=code0;
+            encodedString+=code1;
+            //encodedString+=code2;
+        }
+        yield();
+    }
+    return encodedString;
+}
+
+void sendTelegram(String message)
+{
+    String telegram = "http://steffiundthomas.net/telegramrelais.php?bot_token=" + String(_BOT_ID) + "&chat_id=" + _CHAT_ID + "&body=" + urlencode(message);
+    Serial.println(telegram);
+    HTTPClient http;
+    http.begin(telegram);
+    int httpCode = http.GET();
+    // httpCode will be negative on error
+    if(httpCode > 0) {
+        // HTTP header has been send and Server response header has been handled
+        Serial.printf("[HTTP] GET... code: %d\n", httpCode);
+
+        // file found at server
+        if(httpCode == HTTP_CODE_OK) {
+            String payload = http.getString();
+            Serial.println(payload);
+        }
+    } else {
+        Serial.printf("[HTTP] GET... failed, error: %s\n", http.errorToString(httpCode).c_str());
+    }
+    http.end();
+}
+
 // This array keeps function pointers to all frames
 // frames are the single views that slide in
 FrameCallback frames[] = { drawFrame1, drawFrame2};

void msOverlay(OLEDDisplay *display, OLEDDisplayUiState* state) {
    display->setTextAlignment(TEXT_ALIGN_LEFT);
    display->setFont(ArialMT_Plain_10);
    display->drawString(0, 0, String(timeClient.getFormattedTime()));
}

void drawFrame1(OLEDDisplay *display, OLEDDisplayUiState* state, int16_t x, int16_t y) {
  display->setFont(ArialMT_Plain_16);
  display->setTextAlignment(TEXT_ALIGN_LEFT);
  if(!WiFiConnected)
      display->drawString(0, 20, "Connecting...");
  else
      display->drawString(0, 20, String(WiFi.SSID()));
}

void drawFrame2(OLEDDisplay *display, OLEDDisplayUiState* state, int16_t x, int16_t y) {

bool triggeredJoystick = false;

bool WiFiConnected = false;
bool NTPupdated = false;
bool MessageSentBooted = false;

// Initialize the OLED display using Wire library
SSD1306  display(0x3c, D1, D2);
