-->
Page 1 of 3

Beginners Guide: Basic On NODEMCU/wifi dev board APR 6 2017

PostPosted: Sun Dec 06, 2015 7:28 pm
by forlotto
LAST UPDATE: 09-11-16
Other Important Documentation For ESPBASIC

mmiscool (Developer of Basic) Language Reference
Electrogaurds Driving Lessons
PhilTilson's Printable Documentation


NodeMCU/Basic Wifi Dev Board guide for MMISCOOL Basic IDE
---------------------------------------------------------------
Buy the Basic Wifi Dev Board: http://www.esp8266basic.com/store/p1/ES ... Board.html
with the Basic Wifi Dev Board there is no need to flash firmware the firmware is loaded right from the factory! if you need to keep costs down and wish to support espbasic by donation instead Purchase them from Here.

If you have a nodemcu read the following flashing steps.
FLASH THE NODE MCU WITH BASIC FIRMWARE:
Download the Basic Flasher Utility Latest Version: http://www.esp8266basic.com/download.html
Open the utility
Set your Com Port
Select 4MB Flash
Earlier than version 3.17
On Your NodeMCU Dev Board press and hold the flash button
keep holding the flash button and press the reset button for 2 seconds and let that go keep after an additional 2 seconds let go of the flash button.
Now on the flasher utility on your computer click the flash button if it synced right it will start to program if it syncs wrong it will give you an error.
At the end of flashing a screen will pop up with a bunch of .'s ....................................... like so just hit OK and you should be all setup.
Optionally you can watch this video:


EDIT 7-30-16
On version 3.17 and later now almost all bugs are worked out and there has been a ton of upgrades!!! I suggest you donate for all of these new features!!! Visit Hereand click the yellow donate button.

He makes it so easy now in version 3.17 you just hook up your nodemcu or espbasicdevkit and hit flash firmware button in the software and viola instantly starts flashing no holding down buttons or fumbling around just hit flash firmware and go! I donated a 20 spot with all the bugs nearly fixed and making my life way easier with hands free flashing it was worth the donation Be sure to grab the latest version and check it out!!!!

Wifi access point now also has MAC ID included so the wifi you connect to is not ESPXX:XX:XX:XX x's represent the macid of your device.

WPRINT BUG IS GONE!!! this is huge a big day for basic!!! now all html code works correctly!

Format flash works straight away it is a real format now. Basic has went from Zero to Hero overnight grab your copy of 3.17 and don't forget to donate!
7-30-16


If you are having trouble flashing or want to flash dual SPI aka DIO mode cause you did the dio mod to enable GPIO 9 and 10 as outputs check out these instructions:
get the latest bin file from github https://github.com/esp8266/Basic 4MB
use the espdownload tools http://www.electrodragon.com/w/ESP8266_ ... asher_Tool
Select the file bin file with the offset of 0x000000 as the starting address.
sync and program in the same manner. This should bring everything back to normal.
Alternate versions of this program can be found in this thread:
http://bbs.espressif.com/viewtopic.php?f=5&t=433

ACCESS THE BASIC IDE:
With anything that you have be it a Phone, Tablet, Laptop, etc that has wifi connect to your ESP device by scanning for your wifi connections available and connecting to the one labeled ESP. If you connect and disconnect constantly forget your other networks temporarily so you only connect to the ESP to get it up and running. Once connected open a web browser and visit the following web url http://192.168.4.1/settings . From here you can set the NodeMCU to connect to your wifi router by entering your wifi router SSID and Password in the supplied boxes. Be aware that this is now connected to the internet and should at this point be at the least secured with a password don't forget to save the settings and then click the update button to be sure you have the latest version!
URL's for the IDE
http://192.168.4.1/vars - this page holds all the variables and status of all the pins
http://192.168.4.1/edit - this page is the code editor from where you can write, save, open code
http://192.168.4.1/settings - this page holds settings for Station, AP, Interface, Updates, and formatting the device.
http://192.168.4.1/run - This link will run your code instantly after visiting the link
http://192.168.4.1/filemng - This link will take you to the file manager from where you can save files such as a webpage.
note 192.168.4.1 was used only as an example if you are in station mode aka connected to your router your IP will be different! Check your router device list or use Fing on your phone from playstore to find IP of ESP.

Static IP Connections
If you would like to connect with a static IP here is an example you must add this to your code.
Code: Select allconnect "networkName" "Password" "172.16.0.35" "172.16.0.1" "255.255.255.0"

You must change the info to reflect SSID PASS IP Gateway Subnet as shown above in that order.
UPDATE NOTICE: V3.8 allows you to configure a static ip right in the settings page!

UPDATES ARE NOW EASY !!!! OVER THE AIR (OTA) UPDATE DEC 25 2016 Merry Xmas!:
Use of 4MB flash will allow you now to do OTA (Over The Air) updates.
What this means is that you can now update Basic IDE over wifi no need to hook up to a PC!!!
Once flashed with basic you can update the dev kit without plugging it in at all!

For those unaware of OTA updates at current this allows you to upgrade firmware without the need to hook it up to a computer it basically downloads the update from the internet while in station mode and connected to a router that has internet access. So if you are in AP mode or an isolated router you can temporarily change your info to connect to an internet bound router and do your update and change your settings back as intended.

For those of you folks who really need OTA updates for the latest firmware I have setup a secondary update server for the time being.

Just add this info to the OTA box

Code: Select allcloudwire.tk/ESP8266Basic.cpp.bin


note do not add http:// in front of the link as it will not work this way. Just copy and paste the link as is.

Then save settings

Then hit update.

I have v34 on there currently I may not get everything instantly or I may even miss a build or two but I will check back and update it periodically.

I know this works on nodemcu 4MB flash versions does it work on other smaller flashes or versions I am not sure to be honest have not tested this but their are folders for each version on the server just copy the link and give it a try and report back remember do not use the http:// in front of the link when pasting the link delete this portion.

I have tested it and has worked accurately for the last 6 builds roughly.

May be of use to someone may not who knows I found it rather useful myself so I figured I would share.

How will I know it has worked you say?
How you will know it works is once you click the update button there will be some time that will pass when trying to load the page and it will go offline and reset the unit once it comes back up you can visit the settings page and take note of how the version number has changed.

Enjoy

-forlotto

LOGIN CREDENTIALS UPDATE:
Login key no longer required as of 1.5.8 in the case that your password field is blank in the settings page as well.

HOW MANY LINES OF CODE CAN I USE?

No longer limited to 253 lines of code!!!! <---- NOW UPDATED 5000 lines of code are allowed !!! 5-2-2016
yes five thousand!

CODE SYNTAX NOTES:

- Code for esp8266 basic IS case SeNsiTive!!!
- When comparing to variables if var1 == var2 use two "=" signs.
- When comparing a variable and a value if var1 = 22 use a single "=" sign.
- Brackets don't have to be used onload for example onload mysubroutine will work just as onload [mysubroutine]
IMPORTANT IMPORTANT IMPORTANT BELOW as of 4-17-16
- VERSION 2 alpha 13 introduced a 10 character limit on variable names anything over will make your code DIE!

PINS USED IN BASIC:
See the image below:
nodemcudevkit_v1-0_io.jpg


For those curious here is how the code looks internally to make the pins easier to assign for the NODEMCU.
Code: Select all  if (PinDesignaor == "D0")  pin = 16;
  if (PinDesignaor == "D1")  pin = 5;
  if (PinDesignaor == "D2")  pin = 4;
  if (PinDesignaor == "D3")  pin = 0;
  if (PinDesignaor == "D4")  pin = 2;
  if (PinDesignaor == "D5")  pin = 14;
  if (PinDesignaor == "D6")  pin = 12;
  if (PinDesignaor == "D7")  pin = 13;
  if (PinDesignaor == "D8")  pin = 15;
  if (PinDesignaor == "RX")  pin = 3;
  if (PinDesignaor == "TX")  pin = 1;

NOT ADDED YET: but you can use the actual numbers 9 or 10 in place of SD2 and SD3 respectively
  if (PinDesignaor == "SD2" pin = 9;
  if (PinDesignaor == "SD3" pin = 10;

Not all versions of the nodemcu and wifi dev kit will allow for pin9 to be used properly as a GPIO for on/off function there is a modification that is done on some boards that allows pin 9 to be used in DIO mode...

In order to use GPIO 9 and 10 you will need to flash basic to your nodemcu in DIO mode using flashdownload tools pin 10 does however work well on most every unit I checked if flashed in DIO mode but they are useable pins depending on the hardware. Only way to know if you try but they are useful and useable keep this in mind!

You could use the number or the board number when writing code so you have options! Above is a pin map if you will.

ADDRESSING PINS:
To address pins use the board number "D1"
TOGGLE PIN HIGH EXAMPLE:
Code: Select allio(po,D1,1)

TOGGLE PIN LOW EXAMPLE:
Code: Select allio(po,D1,0)

READ PIN EXAMPLE (NOTE SETS PIN AS INPUT)
Code: Select allif io(pi,D1) = 1 then print "Pin high" else print "pin low"

WARNING WARNING WARNING if you are trying to monitor the status of a pin and constantly refresh it you must set up your own tracking variable when you change the pin status using po otherwise the value will remain static on the page.
Alternatively you can visit the vars page and it will tell you the status of each pin.

In the case of RX and TX printed on the NODEMCU BOARD:
you use them just as they are printed as well
Usage of these pins for ON/OFF is not recommended!

In the case of A0 it is only analog (Not to be used for on/off) so an example how to use it would be as follows:
PIN A0 EXAMPLE CODE:
Code: Select allai bla
print bla

The example above would print analog input.
NOTE: There is no pin number associated with A0 it is just ai !


On/Off Button Example:
Code: Select allButton "On" [on]
Button "Off" [off]
Wait

[on]
io(po,D1,1)
Wait

[off]
io(po,D1,0)
Wait


SPECIAL NOTE: ON/OFF GPIO USE!!!
Avoid using D3 with relays as it will latch on at boot and your wifi will not connect until you remove the GPIO connection from the relay.
D8 Will also latch on and cause conflict do not use this.
D0 can be switched on to reset the device so if you are using an application where a reset may be helpful point to D0 and turn it on to reset the device.
D4 is tied to the LED light there is no conflict here though it is perfectly fine to use D4 for ON/OFF without issue!
This was tested without power applied to the relay board however once power is applied there may be just a quick on then off.
RX and TX should not be used for relays as well they are specific purpose.
GPIO 9 is fair game works for relays just fine I believe it must be flashed in DIO mode to use though!!!
GPIO 10 works on some models Amica models are the only models that I have tested and it works on must be flashed in DIO mode.
NOTE: To flash in DIO mode you must use the esp download tools from electrodragon to do the flashing.

Setting Pin As An Interrupt Example:
Code: Select allinterrupt 0, [test]
wait
[test]
po d4 io(pi,0,)
print "It was triggered"
wait

Interrupt notes:
Will execute a specific branch when a pins status changes. The interrupt polling only occurs when the esp is waiting and useful for things like push buttons trigger events. The branch must end with the wait command.
interrupt {pin no} {branch label}
to disable an interrupt specify no branch label.
interrupt {pin no}


LED based lighting Dimmer switch example:
Code: Select alllightLevel = 0
slider lightLevel 0 1023
button "Set Light" [setLight]
wait

[setLight]
pwo D4 lightLevel
wait


I2C:
The I2C is on GPIO 0 or D3 and GPIO 2 or D4

1WIRE:
1wire is GPIO 2 or D4
UPDATED 11-23-15 (Yes the same GPIO as the I2C rotohammer integrated without issue so far...)


Date & Timestamp Example UTC:
Code: Select allprint time()

There is also the time set up function. This allows for setting the time zone and also can toggle daylight savings time.
To set the time zone to New York, (EST) you would use the following code. The 0 is to specify if daylight savings is to be activated. NOTE A DELAY IS A REQUIREMENT TO PROCESS THE TIMEZONE!!!!
Code: Select alltimesetup(-3,0)
delay 5000
print time()
end


IMPORTANT NOTES ON TIMER CODE!!!!!!!!!!!!!!! 4-17-16


old syntax

Code: Select alltimer 10000 [branch]



new syntax

Code: Select alltimer 10000, [branch]

- See more at: viewtopic.php?f=38&t=9428#sthash.0yvzRSzn.dpuf
HOW DO I USE THINGSPEAK?
First I would only request updates using thingspeak every 30seconds or so ... While there is a 15second delay that is required between requests using thingspeak servers. If you are dealing with critical "Real Time" events I would suggest you look not only into different software but also different hardware more capable of the job. 30 seconds is plenty of data for most applications likely even overkill weather data for instance a minute to minute is better than what some big box weather companies intervals between grabbing data ... So it is OVERKILL in a sense don't let common sense escape your project.
Example using the thingspeak api to do a really complicated hello world.
Code: Select allsendts(5C1J2FHRGQM44M7R,1,"HELLO WORLD FROM ESP8266 BASIC")
print readts(5C1J2FHRGQM44M7R,67698,1)


Twitter post using thingspeak example:

Code: Select allTOP
cls
Textbox MyData
button "Click to send " [postit]
wait
'
[postit]
OPString = "api.thingspeak.com/apps/thingtweet/1/statuses/update?api_key={my API key}&status=" & MyData
print wget(OPString)
wait
goto TOP

Re: Beginners Guide: Run Basic IDE On The NODEMCU

PostPosted: Sat Jan 02, 2016 3:27 am
by forlotto
Continued::::::::

Easy Wifi Settings Module AP or WIFI: Updated Only one or the other enabled version 1.8.1 or later

Code: Select allbutton "Set Wifi Settings" [WifiSettings]
[WifiSettings]
let listWifis = ""
n = wifi.scan()
n = n - 1
html "Number of network found = "
html n
for x = 1 to n
let listWifis = listWifis & wifi.ssid(x)
let listWifis = listWifis & ","
next x
wprint "<br>Select SSID: "
dropdown listWifis selectedWifi
wprint "<br>Password: "
passwordbox networkPW
button "Connect To Wifi" [connectWifi]
wprint "Standalone Access Point (AP) without connecting to your wifi use this! <br> <br> Enter AP Name: "
textbox networkSSID
wprint "<br>Enter AP Password: "
passwordbox networkPWap
wprint "<br>"
button "Start AP" [StartAP]
wprint "<br>"
wait
[StartAP]
WiFioff
ap networkSSID networkPWap
wait
[connectWifi]
WiFioff
connect selectedWifi networkPW
wait



version 1.83 or later
Thanks to cicciocb.

Added ability to upload programs to device using file manager.

Added json function to retrieve values from json string. Documentation coming but here is a taste. -

Json Function Example version 1.83 or later
Code: Select allbla = wget("ip-api.com/json")
print bla
print json(bla,"zip")


Cool real time slider example for light dimming credit goes to CICCIOCB using AJAX and Javascript!!!
Code: Select allmemclear
cls

' this is the default value for pwm out
pdef = 512

' this is the pin defined as pwm output
pwo 13 pdef

' this is the slider
wprint |<input type="range" id="dimmer" oninput="setPWM()" onclick="setPWM()" min="0" max="1023" value="| & pdef & |"/>|

'this is the javascript "ajax" code
fun$ =        |function setPWM() {|
fun$ = fun$ & |lum=document.getElementById("dimmer").value;|
fun$ = fun$ & |window.event.returnValue = false;|
fun$ = fun$ & |var xmlHttp = new XMLHttpRequest();|
fun$ = fun$ & |xmlHttp.open("GET", "msg?pwm=" + lum, false);|
fun$ = fun$ & |xmlHttp.send(null);|
fun$ = fun$ & |return xmlHttp.responseText;}|

' this is where the code is inserted into the html
wprint "<script>" & fun$ & "</script>"

'this is where the prog will jump on slider change
msgbranch [message]
wait

[message]
msgget "pwm" mess
'uncomment this line to see the value received
'serialprintln mess
pwo 13 mess
wait


REAL TIME SLIDER Version 3.0 Branch websockets based! Credits mmiscool
Code: Select allslider x, 0, 1020
timer 500, [set.pwm]
wait

[set.pwm]
io(pwo,d4,x)
wait


ESP BASIC 2.0 alpha 13
fix parser single "
fix for textboxes and other gui eliments spaceces being convereted to + character.
fix snag into web_gui_stuff.ino
dynamic memory handling for variables : more free ram available
introduction of function dim(a$,5,1) = "J"
introduction of arrays
the arrays can be string or float.
dim a(100) => declare a float
dim a$(50) => declare a string
dim b(200) as string => declare a string
undim a => clear the content of the buffer a
memclear => clear all the variables including the arrays

fix spaces printed on the html: now print " AAAA " is displayed as it should

new commands for serial port
serialinput var => get into var the byte received from the serial port (port 1)
serialbranch label => jumps to the label as soon as serial data are received;

instr() with 3rd optional argument
instrrev() with 3rd optional argument
increased the nb of max led neopixel to 512



// some test code for the new functionalities


Code: Select all'''''''''''''''''''''''''''''''''''''''''''''
'This is to test the Arrays
'''''''''''''''''''''''''''''''''''''''''''''
memclear
print ramfree()
dim a(100)

a(0) = 10
a(1) = 20
a(2) = "pollo"

print a(0)
print a(1)
print a(2)
print a(100)

dim b$(10)

b$(1) = "ciao"
b$(2) = "bambina"
' a number into a string array will be converted to string 30 -> "30"
b$(3) = 30
print b$(1)
print b$(2)
print b$(3)

dim c(10)
c(1) = 1
c(2) = 654
' a string into a float array will be treated as 0
c(3) = "ciao"
print c(1)
print c(2)
print c(3)

undim a
undim b$
undim c

dim a$(100) as string
a$(0) = "This"
a$(1) = "Is"
a$(2) = "My"
a$(3) = "First"
a$(4) = "String"
a$(5) = "Array"
a$(6) = "Example"
a$(7) = "1234"
print ramfree()

n = 7
'print the content of the array
for i=0 to n
serialprintln left( a$(i) , 2)
next i

' this is a simple bubble sort algo
for i = 0 to n
for j = i+1 to n
if a$(i) < a$(j) then goto [prox]
t = a$(i)
a$(i) = a$(j)
a$(j) = t
[prox]
next j
next i

'print the content of the array sorted
for i=0 to n
serialprintln a$(i)
next i

'create a big float array
dim big(1000)
for i=0 to 1000
big(i) = i * 2
next i

for i=0 to 1000
serialprintln big(i)
next i

end

'''''''''''''''''''''''''''''''''''''''''''''
'This is to test the serial port interrupt
'
' to test it, simply type keys into the
' terminal emulator on the serial port
'''''''''''''''''''''''''''''''''''''''''''''

memclear
print ramfree()
serialbranch [serialin]
wait

[serialin]
serialinput zz$
Serialprint “received:”
serialprintln zz$
return

'''''''''''''''''''''''''''''''''''''''''''''
'Test for MID= and instr instrrev
' instrrev search string from the end (reverse)
'''''''''''''''''''''''''''''''''''''''''''''

a = "12345678901234567890"
mid( a , 10, 2 ) = "GIORGIO"
print a

print instr(a, "78")
print instrrev(a, "78")

print instr(a, "78", 10)
print instrrev(a, "78", 10)
end


I do have a question on this...

print instr(a, "78")
print instrrev(a, "78")

These two I understand, but what does the 3rd option inside the () do on the following?

print instr(a, "78", 10)

Code: Select allbla = "The quick brown fox jumped over the lazy dog"
print instr(bla,"fox",20)
print instr(bla,"fox",5)
print instr(bla,"fox")

This is where it starts to look for the search string. See the example above.


Other things to note:[/b]
For references on how to program with basic as it is an ongoing project refer to:
http://www.esp8266basic.com
All other references apply to both the NODEMCU & ESP8266 models universally this guide was to address added features for the NODEMCU to make things more understandable.

Be sure to DONATE to http://www.esp8266basic.com something as little as a 20.00 contribution goes a long way to help pay for dev work as well as hosting fees and provides buying power to add new features such as OLED support. In order to add this support products much be purchased which costs money. I find free support is nice but it is about time people that invest time to make stuff like this free also get support they need.

Another way you can DONATE is by buying the ESP Wifi Basic here --> http://www.esp8266basic.com/store/c1/Fe ... ducts.html

Please do donate MMISCOOL is cool indeed he does a lot of work and is a bit of a lone ranger with dev work!
If you have experience and could DONATE to the project or make a fork please do here:
https://github.com/esp8266/Basic

The guy is excellent, competent, and just an all around likeable DEV with a head that could fit through any door. Never talks down to you and speaks in a manner with want to elevate you so you to can contribute.

I was not asked or paid to say any of this either it is purely out of respect and gratuity.

-forlotto

Re: Beginners Guide: Run Basic IDE On The NODEMCU

PostPosted: Sat Jan 02, 2016 3:28 am
by forlotto
TROUBLESHOOTING
--------------------------------------------

Here you will find some common issues and solutions!

V3.x Buttons Not Working From Remote Connection
So for reference the ports should be forwarded as follows: (Correct me if I'm wrong here!)

Internal 81 to external 80
Internal 80 to external 80

If you have multiple devices you want to forward you can access them like so:

In this example we will use port 88 but you can use just about any port while you may want to stay away from the following ports due to common applications using the ports. There may be other ports refer to the things you run on your network.
EXAMPLE PORT 88:

FWD Internal port 80 of device IP to external 88
FWD Internal port 81 of device IP to external 88

To access this device with the web browser it should be http://WANIP:88
To find your wan ip look at your router status page or go to google and type "What is my IP"

Now it is best for security if you set up a server instead to talk to each device etc but it is very possible to remotely control everything without the use of a server if you so wish to do so using this method.

Common application ports below:
Code: Select allHTTP    80, 8080    TCP    Hyptertext Transfer Protocol. Used by web browsers such as Internet Explorer, Firefox and Opera.
HTTPS    443    TCP, UDP    Used for secure web browsing.
IMAP    143    TCP    Email applications including Outlook, Outlook Express, Eudora and Thunderbird.
FTP    20 to 21    TCP    File Transfer Protocol.
SSH    22    TCP    Secure Shell protocol. Provides a secure session when logging into a remote machine.
Telnet    23    TCP    Used for remote server administration.
DNS    53    TCP, UDP    Domain Name System protocol for converting domain names to IP addresses.
NNTP    119    TCP    Network News Transfer Protocol, used for internet discussion groups.
NETBIOS    137 to 139    TCP, UDP    NETBIOS is used for file transfers between Windows machines.
SNMP    161 to 162    UDP    Simple Network Management Protocol. Used by network administrators for remote statistics and information gathering.
LDAP    389    TCP, UDP    Lightwight Directory Services Protocol, used for accessing centralized databases of users and computers.
Microsoft SQL Server    1433 to 1434    TCP, UDP    Database application.
MySQL    3306    TCP, UDP    Database application.
Oracle SQL    1521, 1522, 1525, 1529    TCP    Database application.
Microsoft Terminal Server / Citrix ICA    1494, 1604    UDP    Remote desktop application.
ICQ    4000    UDP    Instant messenger.
Yahoo Messenger    5010    TCP    Instant messenger.
AOL Instant Messenger    5190    TCP, UDP    Instant messenger.
PCAnywhere    5632    TCP, UDP    Remote desktop application.
VNC    5800, 5900    TCP    Virtual Network Computer, allows remote desktop functionality.
Kerberos    88    TCP, UDP    Used for user authentication, mainly on Windows systems.
POP3    110    TCP    Post Office Protocool. For receiving email.
SMTP    25    TCP    Simple Mail Transfer Protocol, used for sending email.
RIP    520    UDP    Routing Information Protocol, part of the core internet infrastructure.
Microsoft PPTP    1723    TCP    Point-to-Point Tunneling Protocol, a VPN implementation.
Windows Media Streaming    1755, 7007    TCP, UDP    
Age of Empires    2300 to 2400, 6073, 47624    TCP, UDP    Multiplayer game.
Call of Duty    20500, 20510, 28960    TCP, UDP    Multiplayer game.
Counter-Strike    1200, 27000 to 27015, 27020 to 27039    TCP, UDP    Multiplayer game.
Doom 3    27650, 27666    TCP, UDP    Multiplayer game.
Everquest    1024, 6000, 7000    TCP, UDP    Multiplayer game.
Far Cry    49001 to 49002, 49124    TCP, UDP    Multiplayer game.
FIFA    3658, 10400 to 10499    TCP, UDP    Multiplayer game.
Microsoft Flight Simulator    2300 to 2400, 6073, 23456, 47624    TCP, UDP    Multiplayer game.
Gamespy Arcade    3783, 6515, 6500, 6667, 13139, 27900, 28900, 29900, 29901    TCP, UDP    Game browser.
Gnutella    6346    TCP, UDP    P2P file sharing application.
GTA2    2300 to 2400, 47624    TCP, UDP    Multiplayer game.
Half Life 2    1200, 27000 to 27015, 27020 to 27039    TCP, UDP    Multiplayer game.
iTunes    3689    TCP, UDP    Music sharing application.
MSN Messenger    1863, 5190, 6891 to 6901    TCP, UDP    Instant messenger.
NBA Live    3658, 9570, 18699 to 28600    UDP    Multiplayer game.
Need For Speed    80, 1030, 3658, 3659, 9442, 13505, 18210, 18215, 30900 to 30999    TCP, UDP    Multiplayer game.
Net2Phone    6801    UDP    VoIP application.
NetFone    10200    TCP    VoIP application.
Neverwinter Nights    5120 to 5300, 6500, 6667, 27900, 28900    UDP    Multiplayer game.
NHL    3658, 10300, 13505    TCP, UDP    Multiplayer game.
No One Lives Forever    2300 to 2400, 7000 to 10000, 27888    TCP, UDP    Multiplayer game.
PhoneFree    1034 to 1035, 2644, 8000, 9900 to 9901    TCP, UDP    VoIP application.
Quake    27650, 27910, 27950, 27952, 27960, 27965    TCP, UDP    Multiplayer game.
Quicktime    6970 to 7000    TCP, UDP    Video streaming application.
Rainbow Six    80, 2346 to 2348, 6667, 7777 to 7787, 8777 to 8787, 40000 to 42999, 44000, 45000    TCP, UDP    Multiplayer game.
RealVNC    5900    TCP, UDP    Remote desktop application.
Remote Desktop    3389    TCP, UDP    Generic remote desktop protocol.
Shiva VPN    2233    TCP, UDP    Tunneling application.
Soldier of Fortune    28910 to 28915, 20100 to 20112    TCP, UDP    Multiplayer game.
Speak Freely    2074 to 2076    UDP    VoIP application.
Starcraft    6112    TCP, UDP    Multiplayer game.
TeamSpeak    8767, 14534, 51234    TCP, UDP    Online voice chat.
Tiger Woods PGA Tour    80, 443, 9570, 13505, 20803, 20809, 32768 to 65535    TCP, UDP    Multiplayer game.
Tight VNC    5800, 5500, 5900    TCP    Remote desktop application.
Tribes    28000, 28001    TCP, UDP    Multiplayer game.
Ultima Online    5001 to 5010, 7775 to 7777, 7875, 8800 to 8900, 9999    TCP    Multiplayer game.
Unreal Tournament    7777 to 7788, 8080, 8777, 9777, 27900, 42292    TCP, UDP    Multiplayer game.
Vonage    5061, 10000 to 20000    UDP    VoIP application.
VPhone    11675    TCP, UDP    VoIP application.
Warcraft    6112 to 6119    TCP, UDP    Multiplayer game.
WebcamXP    8080, 8090    TCP    Video sharing application.
Winamp Streaming    8000 to 8001    TCP    Audio streaming application.
Wingate VPN    809    TCP, UDP    Tunneling application.
World of Warcraft    3724, 6112, 6881 to 6999    TCP    Multiplayer game.
Worms Armageddon    80, 6667, 17010 to 17012    TCP    Multiplayer game.
XBox    80, 1900, 3390, 3074, 3776, 3932, 5555, 7777    TCP, UDP    Game appliance.
Azureus    6881 to 6889    TCP, UDP    P2P file sharing application.
DC++    411, 1025 to 32000    TCP, UDP    P2P file sharing application.
Limewire    6346 to 6347    TCP, UDP    P2P file sharing application.


Problem: Not saving program when I click save.
Your flash did not take correctly please try to reflash basic firmware on your device. You may have to repeat a couple of times to get it to take also make sure to reset the device after waiting 2 minutes after the flash is applied then wait another 30 seconds after reset to be sure that you can connect to the web interface. Be sure your baud rates for your serial port are set to 9600.

Problem: Forgot My Password Can't Login having issues! HOW TO FORMAT THE FLASH version 1.81 or later
Lets format your device!!!!!!! Here's how in steps:

Download Termite for windows: http://www.compuphase.com/software/termite-3.2.exe

Install termite and be sure it is closed.

Download the latest Basic Flasher from http://www.esp8266basic.com

Open the basic flasher.

Hit the format flash button on basic flaher software
then on the nodemcu sync like normal press and continue to hold the flash button while holding push the reset button and let it go keep holding the flash button until you see a lot of blinking then let it go.

Once flashed hit ok on all of the prompts.

Open up termite select the com that you are on and the correct baud rate.

After 30 seconds passes you hit the reset button on your nodemcu then hit the clear button on termite.

Wait for a response once you see a response in termite you can close termite.

Bring Esp Basic flasher back up and hit the flash firmware.

Once open do the sync again let it flash the firmware.

Once firmware is done flashing press the reset button and wait for about 30 seconds.

Viola everything is clear!

Connect to your ESP wifi connection and visit 192.168.4.1 and get back to business.

Problem Wifi Is Retaining Settings And Device is Being Stubborn

The default behavior at start up is the same. The device will attempt to connect to the last network. If unsuccessful it will start its own access point.

When running a program the connect command and the AP command will no longer put the module in to an exclusive mode. You can run both commands and the device will be connected to the network and act as an access point.

The WiFioff command can be called in order to disable all networking and the AP or connect command if run after WiFioff will activate that particular WiFi mode. You can turn them both back on at any point with each of there commands.

IMPORTANT !!!!!!!: If you change your wifi settings it is critical to not only reset your ESP but also it helps to reset your router or wifi device depending on if you are connecting station or AP mode the reason being is that your router or your wifi card will keep the setting lingering so it is a must that you do the reset to your router or your wifi depending on how you connect!!!

Never leave blank data in the station mode box you are better off using incorrect data for the SSID and Pass then no data at all keep this in mind.





Problem: Device Resets or unable to run once software is loaded

As of 4-17-16 be sure that all code contains variables with less 10 characters maximum there was a limit imposed for good measure. Version 2 alpha 13 forward this is a golden rule!!!

Make sure you are not using the following GPIO's for Relay or On/Off function:
D0
D3
D8
SD2
SD3
TX
RX

If you use these GPIO's your device will not work properly may not even show a wifi connection at all.

Best way to fix remove power quickly connect to the edit page and save a blank program.
Under no circumstances except if you are using a mod board that allows SD2 and SD3 to be used and you flashed your board in DIO mode should you use these GPIO's mentioned above for on/off function in which case if you do have a mod board you can only use SD2 and SD3 the rest are still off limits!

Problem: Device Resets Due To URL Requests

FIRMWARE 1.83 fixes memory leak in some of these functions but it is still good practice to follow this advice to prevent conflict below so please be sure you are using 1.83 or later before proceeding!!!!

Code that runs infrequently can be made in to a sub branch and put at the bottom. When the interpreter is running and executing a goto function to execute a branch label it scans from top to bottom for the branch label reading each from flash witch is a bit slow.

You might also want to remove any print statements from executing the msgbranch. This could fill up the html buffer.

You may finally want to use cls at the top of any webpage you see clearing the screen buffer does in fact solve this problem some of the time but I find if the page is running on the device itself often things done in repetition fill up the memory the other way around this is to use a web page which will send the commands on button press to your device and run the webpage locally on your computer, server, phone, raspberry pi, tablet or whatever else this coupled with the cls seems to solve this issue. I have done and tested this with zero issues.

Make sure you are not using GPIO's as mentioned in the first troubleshooting step that will cause conflict with operation of the device you will know because it will reset instantly after using a particular GPIO and if it is repeatable chances are the GPIO that you are using is not safe for ON/OFF operations and is best used for other operations.

Finally make sure you have the most up to date firmware.

Re: Beginners Guide: Run Basic IDE On The NODEMCU

PostPosted: Sat Jan 02, 2016 3:29 am
by forlotto
SECURITY SECTION MAKING SURE YOUR DEVICE IS SECURE IS YOUR RESPONSIBILITY BUT THE FOLLOWING THINGS MAY AID YOU IN THE QUEST FOR SECURITY


Network Security MOST IMPORTANT!!!
Image
In the picture above provided by mmiscool.
For security purposes I would highly suggest using a web server and poking only 1 hole in your firewall with access to that server. Have it do all of the authentication and have it talk to all of the devices on the internal network.

You may also optionally ad a password box to your programs. Make sure that the variable for the password box is cleared before hitting the wait command.

Code Example From Mmiscool: This will turn on a led only when your password is correct.
Code: Select allmySuperSecretPassword$ = "test"
passwordbox pass$
print
button "ON" [turnon]
button "OFF" [turnoff]
wait

[turnon]
if pass$ == mySuperSecretPassword$ then io(po,d4,0)
pass$ = ""
wait

[turnoff]
if pass$ == mySuperSecretPassword$ then io(po,d4,1)
pass$ = ""
wait


File Manager Security

Any thing you upload is by default public. It is placed in the /uploads/filename.ext

Similarly if you set the name of a file in the file editor to one that is in the public uploads directory it will be available publicly from the esp using the http://xx.xx.xx.xx/file?file=filename.ext


If you upload a file and wish to not have it accessible in this meaner you must rename it removing it from the uploads directory. To do this you select the file from the file manager and click the rename button.

An example of this is you upload a bas file you wish to use as your default program. When you upload it it will be named "/uploads/default.bas"

You must rename it to "/default.bas" in stead.

Program Execution Security
I think everyone should be warned about this because the standardized web pages use /input?goto2=OFF for instance common names like this I would guess fairly easily and start turning your lights on at 3AM in the morning or turning on your coffee pot or whatever you folks plan to do with these things. You see it is not the most secure way of doing things without the interpreter itself adding a little randomness to what you are going to it could leave you vulnerable especially folks who use these as garage door openers.

KEEP THIS IN MIND!

One way to fix it is to personally randomize your routine that your button goes to so instead of calling your routine for your off button OFF or whatever is close to that the routine you may want to name FckGWRhqq2 this way some would be tinkerer would not come along and try to start randomly controlling devices on your IP as of right now we are a small niche but incorporation of randomness is important for security purposes. Something all should be made aware of!

Closing Statements
It is important to not that safety and security are entirely up to you as a developer any time you copy and paste something for public consumption even or use someone's code etc ultimately there are no warranty claims made all projects, codes, etc on this forum are in fact just reading material how you plan to use it is how you plan to use it these are just suggestions to help you along.