Mail.ruПочтаМой МирОдноклассникиВКонтактеИгрыЗнакомстваНовостиКалендарьОблакоЗаметкиВсе проекты

Помогите пожалуйста со скетчем для ESP8266

Alex Garmash Ученик (157), открыт 1 месяц назад
код:

 #include <ESP8266WiFi.h> 
#include <ESP8266WebServer.h>

// -----------------------------------------
//=========================================
//HTML + CSS + JavaScript codes for webpage
//=========================================
const char webpageCode[] =
R"=====(
<!DOCTYPE html>
<html>
<!------------------------------C S S--------------------------------->
<head>
</head>
<!----------------------------H T M L--------------------------------->
<body>
<h1>
ESP8266 Webpage <br> (HTML + CSS + JavaScript) <br><br>
<a href="#" id="btn" ONCLICK='JS1()'>JS1</a> <br><br>
<a href="#" id="btn" ONCLICK='JS2()'>JS2</a> <br><br>
<a href="#" id="btn" ONCLICK='JS3()'>JS3</a>
</h1>
</body>
</html>
)=====";

// -----------------------------------------
ESP8266WebServer server(80);
const char* ssid = "name";
const char* passoword = "password";
// -----------------------------------------
void webpage() {
server.send(200, "text/html", webpageCode);
}
// =========================================
void setup() {
Serial.begin(115200);
WIFi.begin(ssid, password);
while (WiFi.status !=WL_CONNECTED) {delay(500);Serial.print(".");}
Serial.println();
Serial.print("IP Address: "); Serial.println(WiFi.localIP());

server.on("/", webpage);
server.begin();
}
// =========================================
void loop() {
server.handleClient();
}

ошибка:

 C:\Users\ALEX\Documents\Arduino\duck\duck.ino:83:3: error: 'WIFi' was not declared in this scope; did you mean 'WiFi'? 
83 | WIFi.begin(ssid, password);
| ^~~~
| WiFi
C:\Users\ALEX\Documents\Arduino\duck\duck.ino:83:20: error: 'password' was not declared in this scope; did you mean 'passoword'?
83 | WIFi.begin(ssid, password);
| ^~~~~~~~
| passoword
C:\Users\ALEX\Documents\Arduino\duck\duck.ino:84:22: error: invalid use of non-static member function 'wl_status_t ESP8266WiFiSTAClass::status()'
84 | while (WiFi.status !=WL_CONNECTED) {delay(500);Serial.print(".");}
| ~~~~~~~~~~~~^~~~~~~~~~~~~~
In file included from c:\Users\ALEX\Documents\Arduino\libraries\ESP8266WiFi\src/ESP8266WiFi.h:34,
from C:\Users\ALEX\Documents\Arduino\duck\duck.ino:1:
c:\Users\ALEX\Documents\Arduino\libraries\ESP8266WiFi\src/ESP8266WiFiSTA.h:84:21: note: declared here
84 | wl_status_t status();
| ^~~~~~
1 ответ
Moon Late Мастер (2351) 1 месяц назад
Стрелочками ^ показаны ошибки. И текстом написано.
Например "'WIFi' was not declared in this scope, did you mean 'WiFi" означает, что WIFi нет такого слова. Вероятно, имели ввиду WiFi ? Тем более, что дальше то пишите именно WiFi.
Ну и так дальше. Объявляя указатель, написали passoword, а потом в функции пишите password - обычная ошибка невнимательности.
В общем, читайте внимательно, что пишите. Хотя, ардуинщики никогда ничего не учат и не читают, ни железо, ни софт. Они просто перебирают скетчи до тех пор, пока не заработает. Это беда 95% ардуинщиков
Alex GarmashУченик (157) 1 месяц назад
аааа, я вроде увидел, но не увидел опечатки
Alex GarmashУченик (157) 1 месяц назад
А что делать с WIFi?
Alex GarmashУченик (157) 1 месяц назад
C:\Users\ALEX\Documents\Arduino\duck\duck.ino:84:22: error: invalid use of non-static member function 'wl_status_t ESP8266WiFiSTAClass::status()'
Alex GarmashУченик (157) 1 месяц назад
C:\Users\ALEX\Documents\Arduino\duck\duck.ino:83:3: error: 'WIFi' was not declared in this scope; did you mean 'WiFi'?
83 | WIFi.begin(ssid, password);
| ^~~~
| WiFi
C:\Users\ALEX\Documents\Arduino\duck\duck.ino:84:22: error: invalid use of non-static member function 'wl_status_t ESP8266WiFiSTAClass::status()'
84 | while (WiFi.status !=WL_CONNECTED) {delay(500);Serial.print(".");}
| ~~~~~~~~~~~~^~~~~~~~~~~~~~
In file included from
c:\Users\ALEX\Documents\Arduino\libraries\ESP8266WiFi\src/ESP8266WiFiSTA.h:84:21: note: declared here
84 | wl_status_t status();
| ^~~~~~

Compilation error: 'WIFi' was not declared in this scope; did you mean 'WiFi'?
Moon Late Мастер (2351) Alex Garmash, WIFi' was not declared in this scope; did you mean 'WiFi'? Перечитать еще раз внимательно слово WIfi. Внимательность - главный инструмент программиста. Больше половины ошибок - из-за невнимательности
Похожие вопросы