Open fernandopasse opened 8 years ago
please, specify what's wrong: don't compile, crash, do not connect, nothing on telegram...
Sorry, this method is not working
String TelegramBOT::connectToTelegram(String command) {
String mess="";
long now;
bool avail;
// Connect with api.telegram.org
IPAddress server(149,154,167,198);
if (client.connect(server, 443)) {
Serial.println(".... connected to server");
String a="";
char c;
int ch_count=0;
client.println("GET /"+command);
now=millis();
avail=false;
while (millis()-now<1500) {
while (client.available()) {
char c = client.read();
//Serial.write(c);
if (ch_count<700) {
mess=mess+c;
ch_count++;
}
avail=true;
}
if (avail) {
//Serial.println();
//Serial.println(mess);
//Serial.println();
break;
}
}
}
return mess;
}
Not connecting to the server
Is not working