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

    Send data from PC to LoPy4 via USB(Ex. Board v3)

    Scheduled Pinned Locked Moved LoPy
    3 Posts 2 Posters 218 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.
    • S Offline
      sadtex
      last edited by

      Hey guys :)

      I try to send via UART data(LoRa Msg/payload) from PC to LoPY.
      It seems i can't send data via USB to LoPy. I am right?

      Tried to debug it manually:

      from machine import UART
      import binascii
      import pycom
      uart = UART(1, 115200)
      uart.init(115200, bits=8, parity=None, stop=1)
      pycom.heartbeat(False)
      i=0
      le=100
      u=1
      while i<le:
          u=uart.read(1)
          if u:                 #Always None
              pycom.rgbled(0xff00)
          print(i)
          i=i+1
      
      

      I have to use the Pins, right?

      Thanks :)

      Kind regards
      Milad

      robert-hhR 1 Reply Last reply Reply Quote 0
      • robert-hhR Offline
        robert-hh @sadtex
        last edited by

        @sadtex The default pins for UART 1 are P3(TX) and P4(RX). If you want to use the USB/UART on expansion board 3, you must select UART 0.
        Instead of using the UART module, you can also use sys.stdin.read() for receiving and sys.stdout.write() for sending.
        Be aware that using UART0 is not fully transparent. It may still react on Control signals like Ctrl-C (abort) and Ctrl-F(safe boot). In order to deactivate this, call micropython.kbd_intr(-1).

        S 1 Reply Last reply Reply Quote 1
        • S Offline
          sadtex @robert-hh
          last edited by

          @robert-hh Ah, Thanks !!

          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