GPIO 02, beep and wifi, A8S card - Printable Version +- Smart Home Automation Forum (https://www.kincony.com/forum) +-- Forum: Technical Support (https://www.kincony.com/forum/forumdisplay.php?fid=1) +--- Forum: News (https://www.kincony.com/forum/forumdisplay.php?fid=5) +--- Thread: GPIO 02, beep and wifi, A8S card (/showthread.php?tid=4170) |
GPIO 02, beep and wifi, A8S card - Vorms - 01-15-2024 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 RE: GPIO 02, beep and wifi, A8S card - admin - 01-15-2024 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? RE: GPIO 02, beep and wifi, A8S card - Vorms - 01-16-2024 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); } RE: GPIO 02, beep and wifi, A8S card - admin - 01-17-2024 you can use digitalWrite(BEEP, false); or digitalWrite(BEEP, true); // whether can turn off beep? RE: GPIO 02, beep and wifi, A8S card - Vorms - 01-17-2024 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 RE: GPIO 02, beep and wifi, A8S card - admin - 01-17-2024 how about digitalWrite(BEEP, true) ? RE: GPIO 02, beep and wifi, A8S card - Vorms - 01-22-2024 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. RE: GPIO 02, beep and wifi, A8S card - admin - 01-22-2024 ok, thanks. |