硬件快联设置网络
微信搜索“乐鑫信息科技”,关注,然后在商铺的Arikiss 设备,输入WiFi名称和密码,将WiFi名称和密码传到设备中
arduino代码如下
#include "Arduino.h"
#include "WiFi.h"
#include <HTTPClient.h>
#include <ArduinoJson.h>
#include <Preferences.h>
Preferences preferences;
String PrefSSID, PrefPassword;
void smartConfigWIFI()
{
WiFi.mode(WIFI_AP_STA);
WiFi.beginSmartConfig();
//Wait for SmartConfig packet from mobile
Serial.println("Waiting for SmartConfig.");
while (!WiFi.smartConfigDone()) {
delay(500);
Serial.print(".");
}
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
preferences.begin("wifi", false);
preferences.putString( "ssid" , WiFi.SSID());
preferences.putString( "password", WiFi.psk());
preferences.end();
Serial.println("SmartConfig done, restarting..");
delay(2000);