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

    How to use UART?

    Scheduled Pinned Locked Moved LoPy
    5 Posts 4 Posters 3.4k Views 5 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.
    • bmarkusB Offline
      bmarkus
      last edited by bmarkus

      How can I connect an external device (GPS receiver) to LoPy and setup, configure and read in program?

      1 Reply Last reply Reply Quote 0
      • J Offline
        jobbyworld
        last edited by jobbyworld

        You need last firmware

        import os
        os.uname()
        (sysname='LoPy', nodename='LoPy', release='0.9.1.b1', version='a78d0fa on 2016-10-21', machine='LoPy with ESP32')
        
        from machine import UART
        com = UART(1,pins=("G23","G24")) #USE P2 P3 , keep UART 0 for usb connection 
        com.readline()
        b'$GPVTG,318.32,T,,M,0.03,N,0.06,K,N*3C\r\n'
        ```
        1 Reply Last reply Reply Quote 0
        • L Offline
          LoneTech
          last edited by

          Tip: for code formatting, use four spaces indentation. The REPL prompt >>> will otherwise make a nested folding quote block.

          import os
          os.uname()
          (sysname='LoPy', nodename='LoPy', release='0.9.1.b1', version='a78d0fa on 2016-10-21', machine='LoPy with ESP32')
          
          
          from machine import UART
          com = UART(1,pins=("G23","G24")) #USE P2 P3 , keep UART 0 for usb connection
          com.readline()
          b'$GPVTG,318.32,T,,M,0.03,N,0.06,K,N*3C\r\n'
          
          J 1 Reply Last reply Reply Quote 0
          • J Offline
            jobbyworld @LoneTech
            last edited by

            @LoneTech Ok thanks

            1 Reply Last reply Reply Quote 0
            • G Offline
              gas
              last edited by

              Hi

              did someone managed to make it work with an external GPS module
              I have the data coming in but when i tried to use the lib micrpyGPS it failed since it wasn't able to allocat memory
              so before starting re writing everything to convert the sentance if someone had any sketchup

              >>> from micropyGPS import MicropyGPS
              Traceback (most recent call last):
                File "<stdin>", line 1, in <module>
              MemoryError: memory allocation failed, allocating 136 bytes
              
              
              >>> com = UART(1,pins=("P3","P4"))
              >>> com.readline()
              b'$GPVTG,,,,,,,,,N*30\r\n'
              >>> com.readline()
              b'$GPG$GPRMC,12$GPVTG,,,,,,,,,N*30\r\n'
              >>> com.readline()
              b'$GPGGA,123243.00,,,,,0,0$GPRMC,123244.00,V,,,,,,,210217,,,N*78\r\n'
              
              1 Reply Last reply Reply Quote 0

              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