Skip to content

Instantly share code, notes, and snippets.

@abuvanth
Last active June 4, 2024 23:00
Show Gist options
  • Save abuvanth/001aa1cb28617faff9c3ab72409dd20a to your computer and use it in GitHub Desktop.
Save abuvanth/001aa1cb28617faff9c3ab72409dd20a to your computer and use it in GitHub Desktop.
from time import sleep
from machine import UART
import time
import network
uart = UART(2, baudrate=115200, tx=17, rx=16)
uart.write("AT+CGDCONT=1,\"IP\",\"jionet\"\r\n")
sleep(1.5)
uart.write("ATD*99#\r\n")
sleep(1.5)
uart.write("AT+CGDATA=\"PPP\",1\r\n")
sleep(1.5)
ppp = network.PPP(uart)
ppp.active(True)
ppp.connect()
sleep(3)
print(ppp.ifconfig())
print(ppp.isconnected())
import urequests as rt
print(rt.get("https://cyberfly.io/").text)
@X-Adam
Copy link

X-Adam commented Jun 4, 2024

When an interrupt comes from the ring indicator pin, I want to read the message from the UART without interrupting your internet connection, just suspend it and then activate your internet connection again.

I can disconnect the connection with ppp.active(False) and read the message from the UART, but; ppp.active(False) this time the internet connection is lost.

I am connecting to a socket server. If the internet connection is lost, I have problems when I connect again due to the nature of my project.

uart = UART(_id, baudRate=_baudRate, rx=_rx, tx=_tx)
uart.write('+++');
time.sleep(3);
uart.read() => None

Can you help me?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment