-
• #2
Hi @Questdoino,
Wifi and ESP8266 are internal modules.
Please check ESP8266_WifiUsage to figure out how to use the module Wifi on ESPs.
-
• #3
Are you using the ESP8266 to provide WiFi to another device running Espruino, or are you running Espruino on the ESP8266 itself?
-
• #4
I`m trying to use it itself
-
• #5
Ok, start from the beginning. At last flashed boot 1.6 and 1.91 firmware but this code doesn`t work
var wifi = require("Wifi"); console.log ("START"); wifi.connect ("mySSID", {password:"myPWD"}, function (){ console.log ("Connected to ap"); } ); wifi.setIP ({ip:"192.168.1.50", gw:"192.168.1.1", netmask:"255.155.255.0"}, function (){ console.log ("Ip set"); } );
ESP stays in default AP mode, doesnt connect to "mySSID" AP and cant find wifi.setIP function
_____ _ | __|___ ___ ___ _ _|_|___ ___ | __|_ -| . | _| | | | | . | |_____|___| _|_| |___|_|_|_|___| |_| http://espruino.com 1v91 Copyright 2016 G.Williams Espruino is Open Source. Our work is supported only by sales of official boards and donations: http://espruino.com/Donate Flash map 1MB:512/512, manuf 0xe0 chip 0x4014 START Uncaught Error: Function "setIP" not found! at line 1 col 167 wifi.setIP ({ip:"192.168.1.50", gw:"192.168.1.1", netmask:"2... ^ =undefined >
The IDE warns that Wifi module not found. Where is it located?
-
• #6
There is no setip function for the esp8266 wifi.
var wifi = require("Wifi"); wifi.connect("my-ssid", {password:"my-pwd"}, function(err){ console.log("connected? err=", err, "info=", wifi.getIP()); });
Use the code from the example page - the wifi ip will get echoed to the console..
-
• #8
Good luck.
-
• #9
That ```setIP()``` function shouldn't be in the docs - it isn't implemented. Your module not found message is not unusual. To test loaded, load the above code in the IDE from right hand side. Then in left hand side key:
wifi.getStatus();```
You should get a return from that to indicate module was found and loaded and then can proceed to connect and subsequently save your wifi settings for easy connect at boot.
-
• #10
As I see, ESP8266 with Espruino onboard cant work in station mode without DHCP on AP enabled? (((
-
• #12
If I follow, you mean you can't consistently find it? Well you can jump on your router and reserve the IP address? That's what I do. Next time it boots you'll know its IP which is great for servers and connecting over Telnet.
-
• #13
Ah so
setIP()
is coming. That explains it! -
• #14
Yep and
setAPIP()
too :)
In any tutorial of using ESP8266 written that the module should be called like that
But there is no Wifi.js in http://www.espruino.com/modules directory. And the terminal callback
confirms that
I assume that we need ESP8266WiFi.js, but the module crashes with
trying to complete a simple task
Function wifi.setIP is defined in reference but there is no such function in module.
What I`m doing wrong?