-
• #2
Dont you have to use the EspruinoWiFi Module with an ESP board?
Try
... var wifi = require('EspruinoWiFi'); ...
and see if this helps.
-
• #3
thanks! it did something, but now it's saying NetworkJS not found.
-
• #4
When using a using a terminal app to send code, you won't have modules autoloaded by default, but that shouldn't be your issue with the Wifi module as that is built in. Are you saying that you get undefined returned from this?
var wifi = require("Wifi");
wifi.getStatus();
``` -
• #5
yes.
attached a pic of the code next to the terminal output when run
1 Attachment
-
• #6
Where is that function call to
main()
coming from? Do you have code saved that is loaded at boot?You should get this, or similar, this is the output of a connection with screen:
| __|___ ___ ___ _ _|_|___ ___ | __|_ -| . | _| | | | | . | |_____|___| _|_| |___|_|_|_|___| |_| http://espruino.com 1v91.122 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 4MB:512/512, manuf 0xef chip 0x4016 >var wifi=require("Wifi") =function () { [native code] } >wifi.getStatus() ={ "mode": "sta", "station": "connected", "ap": "disabled", "phy": "11n", "powersave": "ps-poll", "savedMode": "off" }
In the terminal try issue a
reset()
first, this will clear saved code, then issue asave()
then try again. -
• #7
Instead of using the nodejs - your are better off using the web ide. Install that in chrome and set the board rate to 115200 and use that to programme.
-
• #8
I've tried reflashing the board, no result.
as well as reset()/save() terminal commands
and tried using web ide.
the output is still the same as my screenshot above. -
• #9
This is most odd. We should use the Web IDE though - we have a good starting point for debugging and a common understanding of the interface.
Please can you post the output/screen grabs of these actions.
1) Immediately after you connect via the Web IDE.
2) After you typereset()
in console on left hand side of IDE, and hit return
3) After you typesave()
in the console, and have hit return
4) After you key thevar wifi= require("Wifi")
and hit return
5) After you key thewifi.getStatus()
and hit return -
• #10
Sure
5 Attachments
-
• #11
Thanks for that. I thought it was a big ask.
It's not exactly as I had hoped, but the good news is your board looks fine. Next step is to get yourself on a network.
Something like this, but checkout the documentation for all the detail
wifi.connect(ssid, {password:pw}, function(err){ if (!err) {console.log("Connected");} });
-
• #12
Re the output after
save()
. I'd be inclined to ensure the board is wiped totally. For this you may need something like "esptool.py", I don't know what flasher.js does with respect to wiping board before flashing -
• #13
Ok, I reflashed the board to the 1v91 espruino using esptool.py.
run the commands you said. here's the output. -
• #14
Ok. I reflashed using esptool.py to 1v91 espruino.
Then ran the commands you said above, heres the output.
3 Attachments
-
• #15
Looks good. So what do you want to do next?
You have the whole internet available to your tiny ESP8266... -
• #16
YES! Thanks man much appreciated!!!
I know this has been asked before, but they all used a different method of flashing the nodeMCU. I followed this tutorial (https://goo.gl/0GVDTX) to flash Espruino onto the device.
I am not getting any output from any of the Wifi functions, tried getIp, getStatus, etc... All thats returned is undefined.
i've also tried variations of "... require("Wifi")"
basic functionality works and console output works fine. it's just wifi that isn't working.
code currently on the board
attached file is the terminal output from that code
Is there an easy method of installing all the required modules that doesn't use crazy to understand terminal stuffs :p
thanks for any help!
1 Attachment