-
Notifications
You must be signed in to change notification settings - Fork 108
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
Random disconnection from AP #209
Comments
Hello, |
@Matt93-00 - do you have multiple APs in your environment? |
Yes, but only one is configured on the SSID used for the test |
Hi all, Yes I have more than 1 AP in my environment. It is curious that Wifi.noLowPowerMode() can solve the problem. I m glad to hear that for You. By the way, I switched to WIfi library, no more WifiNina. Sometimes it lost disconnection again, but for my task, it's enough |
Hi people, I am using an Arduino Uno wifi rev 2 with the library WifiNINA. I attach also my code. With this, I can turn on and turn off an imu connected to the board via wifi. When I send the command ON after some variable seconds the device disconnects from AP, forcing the arrest of the functioning of the system.
With another board using WIFI.h library and the same sketch, all is working properly.
I would like to have help to develop the code of wifinina to have no problem of that kind.
Thank you for the support.
`#include <SPI.h>
#include <WiFiNINA.h>
#include "arduino_secrets.h"
#define UART_USB Serial
#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BNO055.h>
#include <utility/imumaths.h>
Adafruit_BNO055 bno = Adafruit_BNO055(55);
float q;
int Value, readacc;
///////please enter your sensitive data in the Secret tab/arduino_secrets.h
char ssid[] = SECRET_SSID; // your network SSID (name)
char pass[] = SECRET_PASS; // your network password (use for WPA, or use as key for WEP)
int keyIndex = 0; // your network key Index number (needed only for WEP)
int status = WL_IDLE_STATUS;
int read_acc = 0;
WiFiServer server(80);
void setup() {
UART_USB.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
/* Initialise the sensor */
bno.begin();
delay(1000);
bno.setExtCrystalUse(true);
UART_USB.println("Access Point Web Server");
// by default the local IP address of will be 192.168.3.1
// you can override it with the following:
// WiFi.config(IPAddress(10, 0, 0, 1));
if (strlen(pass) < 8) {
UART_USB.println("Creating access point failed");
UART_USB.println("The Wi-Fi password must be at least 8 characters long");
// don't continue
while (true);
}
// print the network name (SSID);
UART_USB.print("Creating access point named: ");
UART_USB.println(ssid);
//Create the Access point
status = WiFi.beginAP(ssid, pass);
if (status != WL_AP_LISTENING) {
UART_USB.println("Creating access point failed");
// don't continue
while (true);
}
// wait 10 seconds for connection:
delay(10000);
// start the web server on port 80
server.begin();
// you're connected now, so print out the status
printWiFiStatus();
}
void loop() {
// compare the previous status to the current status
if (status != WiFi.status()) {
// it has changed update the variable
status = WiFi.status();
}
WiFiClient client = server.available(); // listen for incoming clients
if (client) { // if you get a client,
while (client.connected()) { // loop while the client's connected
} // end if (client)
if ( readacc == 1 ) {
}
}
void printWiFiStatus() {
// print the SSID of the network you're attached to:
UART_USB.print("SSID: ");
UART_USB.println(WiFi.SSID());
// print your Wi-Fi shield's IP address:
IPAddress ip = WiFi.localIP();
UART_USB.print("IP Address: ");
UART_USB.println(ip);
//print where to go in a browser:
Serial.print("To see this page in action, open a browser to http://");
Serial.println(ip);
}
void sendHeader(WiFiClient & locClient) {
locClient.println("HTTP/1.1 200 OK");
locClient.println("Content-Type: text/html");
locClient.println("Connection: close");
locClient.println();
}`
The text was updated successfully, but these errors were encountered: