Introduction: UI for MicroPython
Recently, I got an esp8266 board and installed
MicroPython on it. It can be controlled by typing command or uploading a python code to it.
from machine import Pin
led=Pin(2,Pin.OUT)//Pin 2 is the on board LED.
The different version MicroPython, the code maybe different.
The OGT UI comes with a demo UI. For testing it, you need download demo python code and put it to MicroPython .
Step 1: Install OTG UI.
Go to google play and search "otg ui". Install it. It will need some permissions.
Step 2: Download Main.zip
Go to http://www.otgui.com/home?mc=download and download the main.py.
Step 3: Upload the Main.py to Your MicroPython
Upload the main.py to your MicroPython by command:
ampy --port com5 put main.py
You can test it through putty and make sure the code works.
Step 4: Connect Esp8266 to Your Android Phone Through OTG Adapter.
For the first time, It will show a dialog, check the checkbox and click OK button. Then the demo UI will show up. You can click the switch button to control led On/Off.
Step 5: Create Your UI
For creating your UI, you need register an account and download a test tool.
Step 6: Register an Account
Go to www.otgui.com and click "My UIs". it will show a login page, click "Register". Fill the all information and click
Now you can login with your account and default password is "123456", you can change it later.
Step 7: Create a New UI
After login, click "Text UIs". it will show all your UIs.
- Click Add button.
- Input all information.
- Click Save button
It will create a new UI with some code in it.
- Edit the code.
Step 8: Test the UI
Click Preview to see the result.
Step 9: Upload UI to Your Android
Find the App Code in your UI detail page. Then open browser on your android and type the “http://localhost:8889”.
Input the App Code and click save button. Restart the OTG UI App.
It will download the UI to you Android.