Microsoft MakeCode

Can I download the codes to EV3 via bluetooth?

This is awesome. Please us updated on your progress

Yes will do. I have a real job so this work is secondary. Should have something by next week. I scrapped my little console test app for something with a GUI. I’ll need to have some robustness around BT range. I’m sure the kiddos will be moving the robots all over the place.

Thank you Jeff for pointing us into the right direction. Interrestingly, the web serial api just hit the experimental channel in chrome so I was able to download the program from the makecode editor itself in the latest chrome/edge insider (with experimental flags enabled).

PR: https://github.com/microsoft/pxt-ev3/pull/920/files

The feature is now in /beta. You can read more details at https://makecode.mindstorms.com/beta

OK so I don’t need to finish my app? I do have it up and working. I basically watch a folder and then when a .uf2 is written to it I send it over to the connected brick.
I also was able to get FileList to work so now I can have a little folder manager.

Please do - the web serial is still experimental :slight_smile:

I had a little time to work on this today but ran into an issue that took me for ever to figure out.
Any time I would launch a program my brick would hard lock after the program finished. At times even after the 3 finger reset I would have to re-flash the brick to get it to connect back to BT.
app.
I spent a bunch of time looking at the Lego communication spec and the code in the library thinking that I was overwriting some flash bits or something.
I finally figured out (at least I hope) what the issue was. If there is a program running on the brick and you try to send a command (read firmware ver in my case) the brick locks up after the program exits. Oddly enough the listening callback on port information doesn’t seem to cause the issue. The data stop flowing but as soon as the program exits it starts up again. Looks like I’m removing the status indicator :slight_smile:

OK I did find that the StartProgram code that I lifted from someone else was wrong. This was also causing the brick to lock up, some times.

The webserial stack is unable to open the COM port while the program is running (or portview). The user has to make sure to be back on the main screen of the brick to get the program flashing. I also tried to send some opcode to do UI_WRITE(LED, LED_GREEN_PULSE) but ended doing 3 finger resets too.

couple of side questions:

  1. Any idea why an .rbf built from the LME software exits when complete but a makecode rbf doesn’t?
  2. Any know if there is a command code to read the bricks name. for BT that is pretty easy as it get set in the BT enumeration. I’m not sure how to get it via USB or Wifi without asking the brick. I looked through the opUiRead sub codes and didn’t see anything for name. Maybe a read line would do it?

I did end up completing the program (at least for my needs). I found that WiFi is way more robust then BT. I ended up getting a NetGear USB wifi dongle and using that. I will need to get one for each team we are running. This will work for testing in house and then maybe switch to BT when we are at the competition. I also have a little file manager that allows for viewing, running, and deleting files.

I dumped the code and bins here: https://1drv.ms/u/s!Am3UH_kcAxmjjccAqBMInimo6wdRNQ?e=8R2Dl8 sorry not GitHub. Note: This is a total hack job. I’m not a UI programmer. The code here in has no implied or expressed guarantees or warranties. The original Lego.Ev3 library was not written by me. I only did some modifications to it. I may or may not randomly update these file or complete remove the share at any time :wink:

It would be a huge help if the MakeCode programs would exit on completion.

1 Like

I have been trying to make bluetooth transfer from MakeCode work on my Android tablet but have had no success so far. Chrome is latest version and I have activated experimental features, but the bluetooth option doesn’t appear when I hit the Download button, neither in beta version. Do I really need a Windows computer to make it work? Android tablets is what I have available for my students.

Hi Jeff, we’ve added a block to exit the program. Since MakeCode is an evented system, it’s not clear when the program is done.

Unfortunately, we do not have the bandwith to test this feature on Android. The Bluetooth support has been tested on MacOS and Windows successfully.

Thank you for your answer.

Then I guess the same goes for Chromebook, or could it possibly work on that platform? I have tried and gotten the Bluetooth-button to appear in MakeCode, but unfortunately the bluetooth-connection keeps dropping so I’m not able to transfer anything.

I’m wondering if anyone has succeeded with Chromebook? The reality today is that few students have PC or Mac, while many are using Chromebooks or iPads, which I guess is due to the considerable price difference.

We pushed a fix for the BT connection over the weekend. Could you try again?

I tried again but did not get it to work. I have no problem getting it to work in the Lego app so the EV3 brick should be setup correctly for bluetooth transfer. I also have the latest 1.10E firmware installed.

I do the following steps in MakeCode for EV3:

  1. Make a simple test program
  2. Press the Download button.
  3. Press the Bluetooth button in the “Download to you EV3” dialog.

A small window opens up that is supposed to show available units to connect to, but instead it writes “no compatible units found” and the “Connect” button is greyed out.

Do you have any idea what could be wrong?

Did you pair your EV3 brick with your computer before trying this in the browser? You should see the device once this is done.

Windows or Mac, what version? The WebSerial APIs are still in a beta quality phase so something might be up too there.

Rob. I found that my Bluetooth dongle needed to have it’s settings changed: in Windows 10, Settings, Devices, Bluetooth, More Bluetooth Settings, Comm Port. Here you need to add your PC to the list of Comm ports.