Chat freely about the open source Javascript projects for ESP8266

User avatar
By jankop
#33563 Try the following , it is functional .

Code: Select allvar ssid="yourSSID";
var pass="yourPassw";
console.log('connecting to wifi');
ESP8266WiFi.init();
ESP8266WiFi.connect(ssid,pass, function()
           {console.log('connected to wifi');
            var ipInfo = ESP8266WiFi.getIPInfo();
            print("Current IP address is: " +ESP8266WiFi.getAddressAsString(ipInfo.ip)+':'+ESP8266WiFi.getAddressAsString(ipInfo.netmask));
           });


The new command wifi.connect() is not too corect
User avatar
By bfalzarano
#34532 Does anyone have working examples for wifi.createAP(ssid, key, channel, enc, function(err) { ... })?

I've tried the following but receive NetworkJS module not found error

Code: Select allvar wifi = require("ESP8266WiFi_0v25")
wifi.createAP("ESP123SSID","mysecretkey",5,"wpa2",print)



And I've also tried:

Code: Select allESP8266WiFi.init();
ESP8266WiFi.createAP("ESP123SSID","mysecretkey",5,"wpa2",print);


but receive an Uncaught Error: Function "createAP" not found!
at line 7 col 17
ESP8266WiFi.createAP("ESP123SSID","mysecretkey",5,"wpa2",print...
User avatar
By Erni
#34629 Try this:

Code: Select allvar wifi=require("wifi");
var ESP8266=require("ESP8266");

wifi.createAP('ernesto','ernierni' ,'open',function(err){
  print("error "+err);
  print(ESP8266WiFi.getConnectStatus());
  var ipInfo = wifi.getIP();
  print("Wifi IP info: " + (ESP8266.getAddressAsString(ipInfo.ip)));
});
User avatar
By bfalzarano
#34665
Erni wrote:Try this:

Code: Select allvar wifi=require("wifi");
var ESP8266=require("ESP8266");

wifi.createAP('ernesto','ernierni' ,'open',function(err){
  print("error "+err);
  print(ESP8266WiFi.getConnectStatus());
  var ipInfo = wifi.getIP();
  print("Wifi IP info: " + (ESP8266.getAddressAsString(ipInfo.ip)));
});


@Erni thank you for the example. The error I now receive is ESP8266 module not found. However I do see the ernesto SSID but I cannot connect to it using my notebook. The Wifi IP info: that is shown is still the ip address of my local subnetwork so it appears the ESP8266 is still connecting to my local wifi AP. Shouldn't createAP assign an IP address of something like 192.168.4.1 to the device and use dhcp to assign an ip address to my notebook?