# How to go about an extension targeting both Micro:bit AND Arcade (in regards of 'screen')

**URL:** <https://forum.makecode.com/t/how-to-go-about-an-extension-targeting-both-micro-bit-and-arcade-in-regards-of-screen/1472>\
**Category:** micro:bit\
**Created:** [March 21, 2020, 11:12am UTC](https://forum.makecode.com/t/how-to-go-about-an-extension-targeting-both-micro-bit-and-arcade-in-regards-of-screen/1472 "2020-03-21T11:12:45Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![gbraad](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/gbraad/32/338_2.png) [@gbraad](https://forum.makecode.com/u/gbraad)\
**Post date:** [March 21, 2020, 11:12am UTC](https://forum.makecode.com/t/how-to-go-about-an-extension-targeting-both-micro-bit-and-arcade-in-regards-of-screen/1472/1 "2020-03-21T11:12:45Z")

</div>

I would like make an extension that can target either the led matrix on the micro:bit OR the screen on Arcade. But also to abstract the use of pxt-interval ([https://forum.makecode.com/t/how-to-go-about-an-interval-extension](https://forum.makecode.com/t/how-to-go-about-an-interval-extension)) without having to use a different approach for when Arcade is used. Would something like `#define` be possible? or like in Go with explicit tags by filename `_windows.go` or … what I tried before, `function` detection, but this didn’t work. Any suggestions?

---

<div class="post-metadata">

**Author:** ![peli](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/peli/32/12_2.png) [@peli](https://forum.makecode.com/u/peli)\
**Post date:** [March 21, 2020, 11:30am UTC](https://forum.makecode.com/t/how-to-go-about-an-extension-targeting-both-micro-bit-and-arcade-in-regards-of-screen/1472/2 "2020-03-21T11:30:48Z")

</div>

Create an extension that has a “virtual” screen interface and maybe set-interval as well. Then create 2 more specialized extensions for microbit and arcade which are specialized and implement the screen functionality.

---

<div class="post-metadata">

**Author:** ![gbraad](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/gbraad/32/338_2.png) [@gbraad](https://forum.makecode.com/u/gbraad)\
**Post date:** [March 22, 2020, 3:10am UTC](https://forum.makecode.com/t/how-to-go-about-an-extension-targeting-both-micro-bit-and-arcade-in-regards-of-screen/1472/3 "2020-03-22T03:10:48Z")

</div>

so basically there is no way around doing two extensions that are targetting that platform directly. to avoid the trouble it would seem just doing `pxt-awesome-extension-microbit` and `pxt-awesome-extension-arcade` would anyway be needed (even with a ‘virtual’ screen).

instead, what about something that does this platform tagging inside the extension? `main_arcade.ts`, `main_microbit.ts` with some specific metadata perhaps inside the `pxt.json` ? since in that way the shared re-use and platfrm specifc code is contained inside the extension. would not want the user to decide and ‘pick’ what is the right version for him/her.

---

<div class="post-metadata">

**Author:** ![peli](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/peli/32/12_2.png) [@peli](https://forum.makecode.com/u/peli)\
**Post date:** [March 22, 2020, 3:42am UTC](https://forum.makecode.com/t/how-to-go-about-an-extension-targeting-both-micro-bit-and-arcade-in-regards-of-screen/1472/4 "2020-03-22T03:42:39Z")

</div>

It gets tricky if you try to do these kind of file selection if you use the project from the CLI. TypeScript will pick up all the .ts files and get confused because there are multiple copies of the file.  
Eventually, we are working on providing a common core set of primitives, including setInterval, accross all our editors but this takes time as we update them at different times.

Until then, it’s best to split them into multiple repoes.

---

<div class="post-metadata">

**Author:** ![gbraad](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/gbraad/32/338_2.png) [@gbraad](https://forum.makecode.com/u/gbraad)\
**Post date:** [March 22, 2020, 3:56am UTC](https://forum.makecode.com/t/how-to-go-about-an-extension-targeting-both-micro-bit-and-arcade-in-regards-of-screen/1472/5 "2020-03-22T03:56:24Z")

</div>

> [@peli](#):
>
> including setInterval, accross all our editors but this takes time as we update them at different times.

👍 will split for now … main extension will not work on Arcade anyway due to lack of serial. haven’t been able to get this to work.

---

<div class="post-metadata">

**Author:** ![peli](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/peli/32/12_2.png) [@peli](https://forum.makecode.com/u/peli)\
**Post date:** [March 22, 2020, 4:19am UTC](https://forum.makecode.com/t/how-to-go-about-an-extension-targeting-both-micro-bit-and-arcade-in-regards-of-screen/1472/6 "2020-03-22T04:19:53Z")

</div>

Serial is in arcade but hidden. Add it by editing pxt.json and add to dependencies

```
 "serial": "*"
```

---

<div class="post-metadata">

**Author:** ![gbraad](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/gbraad/32/338_2.png) [@gbraad](https://forum.makecode.com/u/gbraad)\
**Post date:** [March 22, 2020, 4:22am UTC](https://forum.makecode.com/t/how-to-go-about-an-extension-targeting-both-micro-bit-and-arcade-in-regards-of-screen/1472/7 "2020-03-22T04:22:26Z")

</div>

As per: [Serial port - #6 by mmoskal](https://forum.makecode.com/t/serial-port/549/6)

> Serial is currently not implemented on stm32

---

<div class="post-metadata">

**Author:** ![peli](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/peli/32/12_2.png) [@peli](https://forum.makecode.com/u/peli)\
**Post date:** [March 22, 2020, 4:25am UTC](https://forum.makecode.com/t/how-to-go-about-an-extension-targeting-both-micro-bit-and-arcade-in-regards-of-screen/1472/8 "2020-03-22T04:25:01Z")

</div>

We are not using serial-port on the device; we are using the STM cube.

---

<div class="post-metadata">

**Author:** ![gbraad](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/gbraad/32/338_2.png) [@gbraad](https://forum.makecode.com/u/gbraad)\
**Post date:** [March 22, 2020, 4:28am UTC](https://forum.makecode.com/t/how-to-go-about-an-extension-targeting-both-micro-bit-and-arcade-in-regards-of-screen/1472/9 "2020-03-22T04:28:00Z")

</div>

> [@peli](#):
>
> we are using the STM cube.

? 🤔 ?

---

<div class="post-metadata">

**Author:** ![gbraad](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/gbraad/32/338_2.png) [@gbraad](https://forum.makecode.com/u/gbraad)\
**Post date:** [March 22, 2020, 4:35am UTC](https://forum.makecode.com/t/how-to-go-about-an-extension-targeting-both-micro-bit-and-arcade-in-regards-of-screen/1472/10 "2020-03-22T04:35:11Z")

</div>

are you implying the use of a virtual COM port with ST-link? If so, that is not very useful to communicate with other hardware.

---

<div class="post-metadata">

**Author:** ![peli](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/peli/32/12_2.png) [@peli](https://forum.makecode.com/u/peli)\
**Post date:** [March 22, 2020, 4:51am UTC](https://forum.makecode.com/t/how-to-go-about-an-extension-targeting-both-micro-bit-and-arcade-in-regards-of-screen/1472/11 "2020-03-22T04:51:49Z")

</div>

Looks like we haven’t implement the serial layer in codal-stm32, so serial won’t work for all STM-based arcade boards.

No, we would implement serial over the pins defined in the bootloader of the arcade device, e.g. micro:bit serial pins on the meowbit edge connector.

---

<div class="post-metadata">

**Author:** ![gbraad](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/gbraad/32/338_2.png) [@gbraad](https://forum.makecode.com/u/gbraad)\
**Post date:** [March 22, 2020, 10:22am UTC](https://forum.makecode.com/t/how-to-go-about-an-extension-targeting-both-micro-bit-and-arcade-in-regards-of-screen/1472/12 "2020-03-22T10:22:35Z")

</div>

> [@peli](#):
>
> we would implement serial over the pins defined in the bootloader of the arcade device

That is what I would expect, but I was therefore also right this doesn’t work now.
