string.indexof() ?



  • How do i return the index of "2,1" within "CREG+ 2,1" for example



  • @misterlisty Not sure of the context exactly, but I am thinking you want to extract the "2,1" from the data returned from the CREG+ AT command? I came up with this to extract the RSSI from the LTE connection and use it in a text string for example..

    # Get the current LTE signal quality
    squallteM = lteM.send_at_cmd('AT+CSQ').strip().split()
    rquallteM = int(squallteM[1].split(',')[0])
    # Evaluate the returned signal quality Data
    rssilteM = 113 - ((rquallteM) * 2)
    ltesqual = ("LTE RSSI: -{} dbM".format(rssilteM))
    

    The .strip() and .split() operators should do what you want.. Hope it helps.


Log in to reply
 

Pycom on Twitter