raspberry_pi_pico:esp-01
Ceci est une ancienne révision du document !
Connexion Wifi via une carte ESP-01
ESP01 | PICO |
---|---|
8 : VCC | 36 : 3V3(OUT) |
4 : CH_EN | |
1 : GND | 38 : GND |
2 : TX | 7 : RX |
7 : RX | 6 : TX |
from machine import UART import utime print() uart0 = UART(1, 115200) # print(uart) # affichage de la configuration de la liaison série def sendCMD_waitResp(cmd, uart=uart0, timeout=2000): print("CMD: " + cmd) uart.write(cmd) waitResp(uart, timeout) print() def waitResp(uart=uart0, timeout=2000): prvMills = utime.ticks_ms() resp = b"" while (utime.ticks_ms()-prvMills)<timeout: if uart.any(): resp = b"".join([resp, uart.read(1)]) print("resp:") try: print(resp.decode()) except UnicodeError: print(resp) # sendCMD_waitResp('AT\r\n') # teste la communication AT # sendCMD_waitResp('AT+CWMODE?\r\n') # affiche le mode wifi # sendCMD_waitResp('AT+CWLAP\r\n', timeout=5000) # affiche les PA disponibles sendCMD_waitResp('AT+CWJAP="ssid","password"\r\n') # connexion au PA sendCMD_waitResp('AT+CIPSTATUS\r\n') # affichage des info sur la connexion sendCMD_waitResp('AT+CIFSR\r\n', timeout=1000) # affiche les adresses IP et MAC
raspberry_pi_pico/esp-01.1680004170.txt.gz · Dernière modification : 2023/03/28 13:49 de dan