Programming NodeMcu 12-E through WEB-REPL Protocol using Micro-python
Programming NodeMcu 12-E through WEB-REPL Prompt using Micro-python
Getting Micro-Python REPL prompt
REPL stands for Read Evaluate Print Loop, and is the name given to the interactive Micro-Python prompt that you can access on the ESP8266. Using the REPL is by far the easiest way to test out your code and run commands.
There are two ways to access the REPL: either via a wired connection through the UART serial port, or via WiFi.
Here in this we will come to know about the Web-REPL prompt over a WiFi
Web-REPL Prompt using WiFi:
Web-REPL allows you to use the Python prompt over WiFi, connecting through a browser. The latest versions of Firefox and Chrome are supported.
For your convenience, WebREPL client is hosted at http://micropython.org/webrepl . Alternatively, you can install it locally from the the GitHub repository https://github.com/micropython/webrepl .
Connecting through Web-Repl:
1. Open the terminal (putty, Mobaxterm, Esplorer) and connect your Node_MCU 12-E.
fig 1: Esplorer Terminal
2.Then give command on terminal
>>>import os
>>>print (os.listdir())
after that give command
>>>import webrepl_setup
after that it will ask for setting the password , set the new password. This password will be required when you start communicating with board through Web page downloaded from above link.
3. Now connect the computer with NodeMcu through WiFi
Device Name: MicroPython --ff209
Password: micropythoN
Congrats! the your system is connected.
4. After connecting through Wifi open the HTML page can be downloaded from above given website.The page will look like this.....
Fig: Web-REPL Prompt Webpage view
4. After that click on connect icon on the webpage.The NODEMCU will get connect and it will ask password which you have saved when you have configured the NodeMcu for Web-REPL prompt after that your micro controller will get connected.
Device Name: MicroPython --ff209
Password: micropythoN
Congrats! the your system is connected.
4. After connecting through Wifi open the HTML page can be downloaded from above given website.The page will look like this.....
Fig: Web-REPL Prompt Webpage view
4. After that click on connect icon on the webpage.The NODEMCU will get connect and it will ask password which you have saved when you have configured the NodeMcu for Web-REPL prompt after that your micro controller will get connected.
For programming using Micro Python
You have to make your code in form of module, for this open your Python(2.7) IDLE and write your code.
After that open the Webpage and connect the device. In right side of page there is option of sending file just send the file. Then write some short of code in the terminal.
code on terminal:
import filename // filename is name file which you have saved as module
filename.modulename // modulename is the name of module
After that press ENTER
..................................................................................................................................................................
Code End
..................................................................................................................................................................
Your program will start running.
Through this Web-REPL prompt you all can program your NodeMcu without connecting it to the Laptop.
Example is in my another blog
.................................................................................................................................................................


Comments
Post a Comment