EXP-CONNECT¶
class EXP
¶
EXP(position, selectors)
position
number, counting from left to right. Valid positions are 1 to 4. selectors
is a tuple composed as in the following: - Ring pin.
Once the EXP
object is created, the expansion board can be used from the application by using the gpio
module.
Both values are integers from 0 to 3.
method start_cellular
¶
start_cellular(apn="", apn_user="", apn_password="",
dhcp=True, ip="", mask="", gateway="",
dns="8.8.8.8", timeout=10000)
apn
: is the APN for the network connection. It depends from the SIM card provider.apn_user
: the username for the network connection authentication. Usually it is empty. Default value empty string.apn_password
: the password for the network connection authentication. Usually it is empty. Default value empty string.
If dhcp
is True (the default) other following four IP related arguments are ignored. When dhcp
is False, the four IP related arguments are:
ip
: is the IP address.mask
: the net mask expressed as A.B.C.D dotted address.gateway
: the gateway to be used as default router.-
dns
: the Domain Name Server to be used for name resolution. Default is "8.8.8.8", the Google DNS. -
timeout
: Connection timeout in milliseconds.CellularException
is raised if connection do not succeed during this time. Default value 10000 ms.
The cellular
module is returned.
method stop_cellular
¶
stop_cellular()
mehod reset_cellular
¶
reset_cellular()
method antenna_on
¶
antenna_on()
start_cellular
method. method antenna_off
¶
antenna_off()
method get_status
¶
get_status()
method get_psm_ind
¶
get_psm_ind()
method get_ring
¶
get_ring()
method setup_ring_cb
¶
setup_ring_cb(cb)
method get_dcd
¶
get_dcd()
method summary
¶
summary()
Example¶
Please refer also to the cellular documentation.
from expansions import connect
from bsp import board
board.init()
# Add the connect expansion
sel = (0,)
con_e = board.next_expansion(connect, sel)
# Start the cellular module and connect to the desired provider
cel = con_e.start_cellular(apn="my-provider-apn")
# Print info of the cell we connected to.
print(cel.cellinfo())
# Stop cellular module
con_e.stop_cellular()
while True:
sleep(1000)