页次: 1
你好,我最近在做esp32 gprs联网时候遇到问题。我这里PPP成功了么,GSM.write('AT+CGDATA="PPP",1\r\n')返回connect,但是最后并没有拿到ip地址。
>>> from machine import UART
>>> import network
>>> GSM = UART(1, baudrate=115200, bits=8, rx=18, tx=19, stop=1, timeout=10)
I (176470) uart: ALREADY NULL
>>> GSM.write('AT\r\n')
4
>>> GSM.read()
b'AT\r\n\r\nOK\r\n'
>>> GSM.write('AT+CGATT=1\r\n')
12
>>> GSM.read()
b'AT+CGATT=1\r\n\r\nOK\r\n'
>>> GSM.write('AT+CGDCONT=1,"IP","uniwap"\r\n')
28
>>> GSM.read()
b'AT+CGDCONT=1,"IP","uniwap"\r\n\r\nOK\r\n'
>>> GSM.write('AT+CGACT=1,1\r\n')
14
>>> GSM.read()
b'AT+CGACT=1,1\r\n\r\nOK\r\n'
>>> GSM.write('AT+CGPADDR=1\r\n')
14
>>> GSM.read()
b'AT+CGPADDR=1\r\n\r\n+CGPADDR: 1,"10.212.2.204"\r\n\r\nOK\r\n'
>>> GSM.write('AT+CGDATA="PPP",1\r\n')
19
>>> GSM.read()
b'AT+CGDATA="PPP",1\r\n\r\nCONNECT\r\n'
>>> ppp=network.PPP(GSM)
>>> ppp.active(True)
True
>>> print(ppp.ifconfig())
('0.0.0.0', '0.0.0.0', '255.255.255.255', '0.0.0.0')
页次: 1