Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    string.indexof() ?

    Scheduled Pinned Locked Moved MicroPython
    python
    2 Posts 2 Posters 212 Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M Offline
      misterlisty
      last edited by

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

      S 1 Reply Last reply Reply Quote 0
      • S Offline
        Steve Williams @misterlisty
        last edited by

        @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.

        1 Reply Last reply Reply Quote 1

        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

        With your input, this post could be even better 💗

        Register Login
        • 1 / 1
        • First post
          Last post

        Pycom on Twitter

        Pycom