- Notifications
You must be signed in to change notification settings - Fork29
This is a Micropython Library from Raspberry Pi Pico to communicate with ESP8266 using AT command over serial UART.
License
noyelseth/rpi-pico-micropython-esp8266-lib
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
This is a Micropython Library for RaspberryPi-Pico to communicate with ESP8266 using AT command.
This is a basic AT Command library for RaspberryPi-Pico, which simplifies the communication process with the ESP8266.The best way to understand the library is with the example shown below, This example shows you how to make a GET/POST request using ESP8266 with the help of the RaspberryPi-Pico.
frommachineimportPinfromesp8266importESP8266importtime,sysprint("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")print("RPi-Pico MicroPython Ver:",sys.version)print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")## Create On-board Led objectled=Pin(25,Pin.OUT)## Create an ESP8266 Objectesp01=ESP8266()esp8266_at_ver=Noneprint("StartUP",esp01.startUP())print("Echo-Off",esp01.echoING())print("\r\n")'''Print ESP8266 AT comand version and SDK details'''esp8266_at_ver=esp01.getVersion()if(esp8266_at_ver!=None):print(esp8266_at_ver)'''set the current WiFi in SoftAP+STA'''print("WiFi Current Mode:",esp01.setCurrentWiFiMode()print("\r\n\r\n")'''Connect with the WiFi'''print("Try to connect with the WiFi..")while (1):if"WIFI CONNECTED"inesp01.connectWiFi("ssid","pwd"):print("ESP8266 connect with the WiFi..")break;else:print(".")time.sleep(2)print("\r\n\r\n")print("Now it's time to start HTTP Get/Post Operation.......\r\n")while(1):led.toggle()time.sleep(1)''' Going to do HTTP Get Operation with www.httpbin.org/ip, It return the IP address of the connected device '''httpCode,httpRes=esp01.doHttpGet("www.httpbin.org","/ip","RaspberryPi-Pico",port=80)print("------------- www.httpbin.org/ip Get Operation Result -----------------------")print("HTTP Code:",httpCode)print("HTTP Response:",httpRes)print("-----------------------------------------------------------------------------\r\n\r\n")''' Going to do HTTP Post Operation with www.httpbin.org/post '''post_json="{\"name\":\"Noyel\"}"httpCode,httpRes=esp01.doHttpPost("www.httpbin.org","/post","RPi-Pico","application/json",post_json,port=80)print("------------- www.httpbin.org/post Post Operation Result -----------------------")print("HTTP Code:",httpCode)print("HTTP Response:",httpRes)print("--------------------------------------------------------------------------------\r\n\r\n")
You are very welcome to contribute: stability bugfixes, new hardware support, or any other improvements. Please.
This project is released under The MIT License (MIT) ©Noyel Seth
About
This is a Micropython Library from Raspberry Pi Pico to communicate with ESP8266 using AT command over serial UART.
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Packages0
Uh oh!
There was an error while loading.Please reload this page.



