A place users can post their projects. If you have a small project and would like your own dedicated place to post and have others chat about it then this is your spot.

User avatar
By Deion Adel
#91907 Today let us see how to light up the small light on the microcontroller in python and let it connect to the WiFi at home.

[list=]1. Environmental Preparation[/list]
Python3.7.6
MCU-esp8266 CH340G
esptool module
esp8266 development board firmware
Download link: http://micropython.org/download#esp8266

Graphical tool-uPyCraft
Download link: http://docs.dfrobot.com.cn/upycraft/

2.Connect the Development Board
Use the data cable at the time of purchase to connect the microcontroller and the computer, the driver will be installed automatically, we only need to find the COM interface corresponding to the device.

First erase the flash content
Picture 1.jpg

Start to burn the firmware
Picture 2.jpg

Configure graphical tools
Picture 3.jpg

(Select the COM interface used for debugging)
Picture 4.jpg

(Select the type of development board)
Picture 5.jpg

(After successfully connecting to the development board, the small lock picture changes)


3.Light up the Small Lights
Code: Select allfrom machine import Pin
from time import sleep
led = Pin(2,Pin.OUT)
while 1:
   len.on()
   sleep(1)
   led.off()
   sleep(1)


Picture 6.jpg


4.Connect WIFI
Code: Select allimport network
wlan = network.WLAN(network.STA_IF)
wlan.active(True)
if not wlan.isconnected():
   print('connecting to network…')
   wlan.connect('Tenda_456ED8', 'Pwd@1234')
   while not wlan.isconnected():
     pass
print('network config:', wlan.ifconfig())


Picture 7.jpg
You do not have the required permissions to view the files attached to this post.