raspberry_pi_pico:esp-01
Ceci est une ancienne révision du document !
Connexion Wifi via une carte ESP-01
Câblage :
ESP01 PICO VCC : 8 ——- 36 : 3V3(OUT)
CH_EN : 4 ——- 36 : 3V3(OUT)
GND : 1 ——- 38 : GND TX : 2 ——- 7 : RX RX : 7 ——- 6 : TX
ESP01 | PICO |
VCC : 8 | 3V3(OUT) |
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.1680002454.txt.gz · Dernière modification : 2023/03/28 13:20 de dan