Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
GPIO 02, beep and wifi, A8S card
#3
Many thanks for yur reply.
You will find the minimum script to do the troble.
If you run the script, the buzzer make a lot of noise.

#include "esp_wifi.h"
#include <WiFi.h>

#define BEEP 2

void WiFiStationConnected(WiFiEvent_t event, WiFiEventInfo_t info){
Serial.printf("%lu:: Connected to AP successfully, SSID: %s, level: %d [dB]\r\n", millis(), WiFi.SSID().c_str(), WiFi.RSSI());
}

void WiFiStationDisconnected(WiFiEvent_t event, WiFiEventInfo_t info){
Serial.println(F("Disconnected from WiFi"));
connectToNextNetwork();
}

void WiFiGotIP(WiFiEvent_t event, WiFiEventInfo_t info){
IPAddress ip = WiFi.localIP();
Serial.printf("WiFi connected, IP address: %d.%d.%d.%d, level: %d [dB]\r\n", ip[0], ip[1], ip[2], ip[3], WiFi.RSSI());
} // WiFiGotIP

void setup(){
pinMode(BEEP, OUTPUT); // TEST THIERRY
digitalWrite(BEEP, false);

Serial.begin(115200);
while(!Serial){
;
}
delay(1000);

Serial.println("Starting..");

WiFi.onEvent(WiFiStationConnected, ARDUINO_EVENT_WIFI_STA_CONNECTED); // version 2.0x
WiFi.onEvent(WiFiGotIP, ARDUINO_EVENT_WIFI_STA_GOT_IP); // version 2.0x
WiFi.onEvent(WiFiStationDisconnected, ARDUINO_EVENT_WIFI_STA_DISCONNECTED); //version 2.0x

connectToNextNetwork();
} // setup

void connectToNextNetwork(){
WiFi.disconnect(true, true);
WiFi.begin("truc", "machin");
}

void loop() {
;
}

Hello again,
I reduce the code to produce the beep noise:

#include "esp_wifi.h"
#include <WiFi.h>

#define BEEP 2

void setup(){
pinMode(BEEP, OUTPUT); // TEST THIERRY
digitalWrite(BEEP, false);

Serial.begin(115200);
while(!Serial){
;
}
delay(1000);

Serial.println("Starting..");

}

void loop() {
WiFi.begin("truc", "machin");

delay(1000);
}
Reply


Messages In This Thread
GPIO 02, beep and wifi, A8S card - by Vorms - 01-15-2024, 10:32 PM
RE: GPIO 02, beep and wifi, A8S card - by admin - 01-15-2024, 10:44 PM
RE: GPIO 02, beep and wifi, A8S card - by Vorms - 01-16-2024, 05:06 PM
RE: GPIO 02, beep and wifi, A8S card - by admin - 01-17-2024, 12:08 AM
RE: GPIO 02, beep and wifi, A8S card - by Vorms - 01-17-2024, 12:21 AM
RE: GPIO 02, beep and wifi, A8S card - by admin - 01-17-2024, 12:23 AM
RE: GPIO 02, beep and wifi, A8S card - by Vorms - 01-22-2024, 05:57 PM
RE: GPIO 02, beep and wifi, A8S card - by admin - 01-22-2024, 09:36 PM

Forum Jump:


Users browsing this thread:
1 Guest(s)