Hi guys, I really need help.
i have an esp32 and am trying to connect it to wifi. My ESP32 can connect to WiFi, but when I try to test the connection to Telegram it fails. I think it's because the esp32 doesn't have internet access.
when I use hotspot tethering from the smartphone then the esp32 has internet access
there is the code :
#include <Arduino.h>
#include <WiFi.h>
#include <CTBot.h>
String ssid = "Untan2023";
String pass = "Informatika";
String token = "************************";
void setup() {
WiFi.mode(WIFI_STA);
WiFi.disconnect();
delay(500);
WiFi.begin(ssid, pass);
int reset = 0;
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
reset ++;
Serial.print("Menyambungkan ke WiFi : ");
Serial.println(ssid);
if (reset == 5) {
ESP.restart();
}
}
if (WiFi.status() == WL_CONNECTED){
Serial.println("Wifi is Connected");
} else {
Serial.println("Wifi is Not Connected");
}
delay(500);
myBot.setTelegramToken(token);
//connect telegram bot
delay(500);
if(myBot.testConnection()) {
Serial.println("\nKoneksi ke Telegram Berhasil !");
} else {
Serial.println("\nKoneksi ke Telegram gagal !");
}
}
void loop() {
// put your main code here, to run repeatedly:
}
Is this really a bug in esp32?
or
are there any wifi settings that need to be changed?
how to solve this problem?
i really thanks for your help.