示例#1
0
from network import LTE


def send_at_cmd_pretty(cmd):
    response = lte.send_at_cmd(cmd).split('\r\n')
    for line in response:
        if (len(line) > 0):
            print(line)


lte = LTE()
print("imei", lte.imei())
print("is_connected", lte.isconnected())
print("ue_coverage", lte.ue_coverage())
print("iccid", lte.iccid())
print("time", lte.time())

send_at_cmd_pretty('AT+CGMI')
# PYCOM
send_at_cmd_pretty('AT+CGMM')
# FiPy
send_at_cmd_pretty('AT+CGMR')
# UE5.0.0.0d
send_at_cmd_pretty('AT+CGSN=0')

send_at_cmd_pretty('AT+CGSN=1')

send_at_cmd_pretty('AT+CGSN=2')

send_at_cmd_pretty('AT+CGSN=3')
# +CGSN: "00"
示例#2
0
from io_control import pmic_ce, get_charger_status
from network import LTE
​
pycom.heartbeat(False)
​
while False:
    pycom.rgbled(0xFF0000)  # Red
    time.sleep(1)
    pycom.rgbled(0x00FF00)  # Green
    time.sleep(1)
    pycom.rgbled(0x0000FF)  # Blue
    time.sleep(1)

if False:
    lte = LTE(carrier="verizon")
    imei = lte.imei()
    print(imei)

if False:
    adc = machine.ADC()             # create an ADC object
    apin = adc.channel(pin='P13',attn=machine.ADC.ATTN_0DB)   # create an analog pin on P13
    val = apin()                    # read an analog value
    print(val)
    volt = apin.voltage()
    print(volt)

if False:
    #i2c = I2C(0, pins=('P9','P10'))     # create and use non-default PIN assignments (P9=SDA, P10=SCL)
    #i2c.init(I2C.MASTER, baudrate=1000) # init as a master
    i2c = I2C(0)
    sda = 'P9'