問題是我想執行下面的代碼,但是當ESP8266關閉時,我再次啓動它,一切都消失了。 那麼,有沒有一種解決方案可以讓我的Arduino Uno控制ESP8266的工作。通過Arduino設置ESP8266的參數
我的程序打擊是通過網絡瀏覽器控制GPIO2。
非常感謝大家!
我的代碼:
#include <ESP8266WiFi.h>
#include <aREST.h>
// Create aREST instance
aREST rest = aREST();
// WiFi parameters
const char* ssid = "Protect Big Dragon 4";
const char* password = "18717772056";
// The port to listen for incoming TCP connections
#define LISTEN_PORT 80
// Create an instance of the server
WiFiServer server(LISTEN_PORT);
void setup(void)
{
// Start Serial
Serial.begin(115200);
// Give name and ID to device
rest.set_id("2");
rest.set_name("lamp_control");
// Connect to WiFi
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi connected");
// Start the server
server.begin();
Serial.println("Server started");
// Print the IP address
Serial.println(WiFi.localIP());
}
void loop() {
// Handle REST calls
WiFiClient client = server.available();
if (!client) {
return;
}
while(!client.available()){
delay(1);
}
rest.handle(client);
}
'一切都消失了'更具體的東西嗎?你的意思是GPIO引腳狀態在重新啓動後沒有再次具有相同的狀態?然後將GPIO配置保存爲閃存並在重新啓動後再次讀出。 「那麼,有沒有一種解決方案可以讓我的Arduino Uno控制這臺ESP8266的工作?'現在你不希望它被一個Web客戶端控制,而是通過一個Arduino來控制?你的問題對我來說很不明確,請澄清。 –
我只是說我需要重新上傳一次,我重新啓動esp8266 – winbestfly
謝謝格哈德 – winbestfly