Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot connect to AP #231

Open
rwb196884 opened this issue Sep 23, 2024 · 0 comments
Open

Cannot connect to AP #231

rwb196884 opened this issue Sep 23, 2024 · 0 comments

Comments

@rwb196884
Copy link

rwb196884 commented Sep 23, 2024

#include <SoftwareSerial.h>
#include <WiFiEsp.h>

#define RX 6 // blue
#define TX 7 // black
SoftwareSerial Esp8266(RX, TX);
const char AP[] = "calleva";
const char PASS[] = "top-secret-password";

void setup() {
  Serial.begin(9600);
  Serial.println("setup..."); // ESP8266 seems to need some time.
  delay(3000);
  connect_wifi();
  connect_ap();
}

void connect_wifi() {
  while (true) {
    Serial.println("-- connect_wifi --");
    Esp8266.begin(9600);
    WiFi.init(&Esp8266);
    if (WiFi.status() == WL_NO_SHIELD) {
      blink(1); // Error 1: couldn't connect to WiFi hardware.
      delay(1000);
    } else {
      return;
    }
    Esp8266.end();
  }
}

void connect_ap() {
  int status = -1;
  while (status != WL_CONNECTED) {
    status = WiFi.begin(AP, PASS);
    Serial.print("-- connect_ap: status is ");
    Serial.println(status);
    blink(2); // Error 2: couldn't connect to WiFi AP.
    Serial.println();
  }
}

output

[WiFiEsp] Initializing ESP module
[WiFiEsp] >>> TIMEOUT >>>
[WiFiEsp] >>> TIMEOUT >>>
[WiFiEsp] Initilization successful - 2.0.0
[WiFiEsp] >>> TIMEOUT >>>
[WiFiEsp] Failed connecting to calleva
-- connect_ap: status is2

[WiFiEsp] Failed connecting to calleva
-- connect_ap: status is2

[WiFiEsp] Failed connecting to calleva
-- connect_ap: status is2
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant