Microsoft MakeCode

How to use serial communication from an extension?

I have an external board that relies on a serial communication. When I use the micro:bit with redirect I can communicate with this board. So as a next step I wanted to create an extension for re-use. However, how can I address the serial connection?

I have an initialize function, but either using serial (as namespace) or Serial as a device aren’t recognized. What do I need to do before I can use createSerial ?

Think I got something. Will try and get back here …

For the moment I will use serial.redirect inside the extension to do what I want, but this would limit to a single serial device and renders external debugging useless.

This worked: https://makecode.microbit.org/_cMyaLHX38ejD but as stated, this seems to limit the use to a single serial device.