XRP Code Editor Bluetooth connection questions

Looking forward to Bluetooth support in the XRP Code Editor some day.
Last week, my students built quite a few “USB cord winders” as they attempted to debug their projects via the USB cable. :wink:

For classroom use with many XRPs running at the same time, we need to be able to:

  1. Know the Bluetooth id/name of the XRP we want to connect to. Perhaps the name could show up in the Shell/REPL each time the Pico is started? That way, one could see the Bluetooth name via the USB connection, remember it, unplug the USB cable, and re-connect using Bluetooth, and select the correct XRP.
  2. Be able to easily unpair the Bluetooth connection so that it can be readily paired with another PC. Consider that the XRP ↔ computer pairing could change every class session.

Thanks,
Wayne

1 Like

1 - I believe this is the plan once Bluetooth support gets rolled out (ie. automatic display of the Bluetooth name). In the meantime, I believe the code below will display the name used by the current staging implementation:

import machine

x = (''.join(['{:02x}'.format(b) for b in machine.unique_id()]))
name="XRP-" + x[11:]

print(name)

2 - Idk about this one, @Fgrossman?

1 Like

Yes, that will print out the ID for a connected XRP.

1 Like

@Fgrossman: Your thoughts on this? I haven’t done a lot of testing with the staging yet, but it appears that once paired with one machine, it doesn’t show up in the scan for another machine.

That is correct. The XRP will only advertise itself when it is not paired.

Note: the easiest way to unpair an XRP is refresh the browser page of XRPCode.

Bluetooth is a game changer when working with robots!

I teach an after-school middle-school robotics class (based on the micro:bit) every spring using MicroBlcoks. The 2023 class had to constantly plug a USB cable into their robots to make program changes. This year, 2024, MicroBlocks had BLE support and the students were able to change their code wirelessly. The robot could be driving around on the floor or following a track and students could change code or adjust parameters on the fly. As a result, they were able to do much more in the same amount of time.

So it will be great when XRPCode get’s Bluetooth support. Meanwhile, if you’d like to get a taste of what using Bluetooth is like, you might try the MicroBlocks pilot release, which supports Bluetooth connections to the XRP.

You’ll first need to install the MicroBlocks firmware on your XRP by downloading vm_pico_xrp.uf2 ( https://microblocks.fun/downloads/pilot/vm/vm_pico_xrp.uf2), putting the XRP into boot mode, and dropping the .uf2 file onto the RPI-RP2 drive.

The click on the “Run Pilot in Browser” button on the downloads page (https://https://microblocks.fun/download) to run the pilot release in the Chrome or Edge browser. Click the USB icon and select “connect (BLE)” from the menu. MicroBlocks XRP’s in range will appear in the connect dialog as “Pico XYZ” where “XYZ” is a different three letter code for each XRP. Select the one you want to connect. Load the XRP library and start coding!