Microsoft MakeCode

Arcade - pybadge Serial - No Data Sent/Received

I am trying to connect to the serial port on a pybadge from MakeCode Arcade I have configured the application as follows but I am not receiving any data

pxt.json - Configured to import serial

{
    "name": "SerialTest1",
    "description": "",
    "dependencies": {
        "device": "*",
        "serial": "*",
        "arcade-text": "github:microsoft/arcade-text#v1.3.0"
    },
    "files": [
        "main.blocks",
        "main.ts",
        "README.md",
        "main.py"
    ],
    "preferredEditor": "tsprj"
}

main.js - Displays error -1012 from serialDevice.Read()

let text : TextSprite = null
text = textsprite.create("Starting")
text.setOutline(1, 6)
scene.setBackgroundColor(0)
serial.redirect(pins.TX, pins.RX, BaudRate.BaudRate115200)
text.setText("Started12")
forever(function on_forever() {
    pause(2000)
    let byte = serial.device().serialDevice.read()
    text.setText(byte.toString())
})

Pin Connections

Python Verification Code

I have verified that text can be sent and received with the following circutpython code

import board
import busio
uart = busio.UART(board.TX, board.RX, baudrate=115200)
while True:
   data = uart.read(1)  # read a byte
   if data is not None:
      data_string = ''.join([chr(b) for b in data])
      print(data_string, end="")
      uart.write(data)
1 Like

@mmoskal any ideas?

1 Like

I have also raised Serial - No Send / Receive Data · Issue #2822 · microsoft/pxt-arcade (github.com)

this should be in the microbit forum

Why is that? The device being connected to is a microbit which is working correctly. This issue relates to the pybadge which does not send or receive serial data

1 Like

then this should be in the pybadge forum

The PyBadge doesn’t have its own Forum @TakeTheL08. The PyBadge (and PyBadge LC, and EdgeBadge, and PyGamer) is manufactured by Adafruit Industries, so you could go to their forums too. You could also go to their Discord, which you can find at the end of almost every blog post.

@Grant-Archibald-MS

@TakeTheL08 specifically this looks to be an issue in pxt-arcade and how it interfaces with SAMDSerial.cpp as part of the CODAL library

2 Likes

I tryed import serial just like yours : “serial”: “*”,
It’s OK in simulator, but got following error when downloading
The hex file is not available, please connect to internet and try again.
Is it because current serial implement doesn’t compatible with stm cpu (which MeoBit using) ?