Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
GPIO 02, beep and wifi, A8S card
#1
Hello,

I have an A8S card.
This card has an buzzer or beep at GPIO 2
I have a software that search for a valid wifi, using wifi events. After each disconnection it will try the next available wifi until it can get an ip. Sometimes there is no wifi at all and the system loop for ever.

The use of pin 2 seams to have a conflict with the wifi.
When the system loop the beep turn on, even I switch it to off.

Is that any means to switch off the beep ?
I can provide code if this is needed

Many thanks for your help.

Best regards
Thierry
Reply
#2
you can download our KCS firmware for testing your A8S board. here is online guide: https://www.kincony.com/esp32-kcsv2-firmware.html
i don't know what software you are using? do you write your own arduino code?
Reply
#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
#4
you can use digitalWrite(BEEP, false); or digitalWrite(BEEP, true); // whether can turn off beep?
Reply
#5
Hello,
Thanks for your reply.
Unfortunatly, digitalWrite(BEEP, false) doesn't solve the problem.
You can try the very small piece of code already joined.
To solve this problem, You have to pinMode after the wifi got an ip. And then after you can do digitalWrite(BEEP, false).
Please try the code I joigned ...
Best regards
Thierry
Reply
#6
how about digitalWrite(BEEP, true) ?
Reply
#7
digitalWrite(BEEP, true) doesn't solve the problem.
it's seams that WiFi.begin modify several times the pin 2 even any PinMode or digitalWrite instruction.
it's like a "feature" of the ESP32.
The solution I find is AFTER the wifi got an Ip, do the pinmode and digitalWrite for the pin 2.
Reply
#8
ok, thanks.
Reply


Forum Jump:


Users browsing this thread:
1 Guest(s)