Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/andrvv/mpysocket
A socket lib for the esp01 and esp01s.
https://github.com/andrvv/mpysocket
esp01 esp01s micropython module python socket
Last synced: about 11 hours ago
JSON representation
A socket lib for the esp01 and esp01s.
- Host: GitHub
- URL: https://github.com/andrvv/mpysocket
- Owner: ANDRVV
- License: mit
- Created: 2022-10-17T18:29:58.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-12-02T00:12:12.000Z (about 1 year ago)
- Last Synced: 2023-12-02T01:25:52.882Z (about 1 year ago)
- Topics: esp01, esp01s, micropython, module, python, socket
- Language: Python
- Homepage:
- Size: 12.7 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# mpySocket
A socket lib for the esp01 and esp01s.# Info
## All Protocol
- TCP
- TCPv6 (IPv6)
- SSL
- SSLv6 (IPv6)## What mpySocket can do
- Verify if ESP01/ESP01s is started or it works;
- Restart ESP01/ESP01s;
- Get local IPv4;
- Get local MAC Address;
- Get WiFi Mode;
- Set WiFi Mode (default is SoftAP+STA (3));
- Scan Networks,
- Connect/Disconnect to Network;
- Create/Delete Server;
- Connect/Disconnect to a server;
- Send/Recv Message (with a specific buffer).# Example
```python
import mpySocket, time
from machine import Pinsocket = mpySocket.setup(0, 1)
socket.connectNetwork("SUPERROUTER", "superpassword")
socket.createServer(12000, socket.TCP)led1 = Pin(15, Pin.OUT)
led1.value(1)
led = Pin(28, Pin.OUT)
while True:
time.sleep(0.1)
try:
data = socket.recv(100)
if "on" in data:
led.value(1)
elif "off" in data:
led.value(0)
elif "quit" in data:
break
else:
pass
except:
pass
socket.deleteServer()
socket.disconnectNetwork()
led1.value(0)
led.value(0)```