-->
Page 5 of 6

Re: general examples

PostPosted: Mon Nov 09, 2015 2:06 pm
by jankop
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

Re: general examples

PostPosted: Fri Nov 20, 2015 12:49 am
by bfalzarano
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...

Re: general examples

PostPosted: Sat Nov 21, 2015 11:51 am
by Erni
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)));
});

Re: general examples

PostPosted: Sun Nov 22, 2015 2:02 am
by bfalzarano
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?