forked from Neutree/micropython
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Example on how to automatically connect to the APN #38
Labels
enhancement
New feature or request
Comments
You may try something like: import cellular
import time
timeout = time.ticks_ms() + 1e4
while time.ticks_ms() < timeout:
try:
cellular.gprs("apn", "user", "pass")
break
except CellularError:
if time.ticks_ms() < timeout:
time.sleep(1)
else:
raise |
I added a callback def f(status):
if status == 1:
cellular.on_status_event(None)
cellular.gprs("internet", "", "")
cellular.on_status_event(f) and it will hopefully work. |
Feel free to reopen. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Could you provide an example on how to automatically connect to the APN when booting?
I implemented a loop but often it just won't connect forever.
The text was updated successfully, but these errors were encountered: