Passing a variable from Magic Leap 2


I am looking to pass a boolean variable from Magic Leap 2 in real time to an Arduino or other kind of development board. The only past post I found is this one from Jan 2023:

After reading this post and doing some research, here are a few questions:

  1. Is using Android platform via Bluetooth the best way to go forward?
  2. There is Bluetooth API in the Developers Doc. Is that relavant?
    Bluetooth | MagicLeap Developer Documentation
  3. Are there any new examples that I can run that might help?
  4. Any other ways to pass a variable out? Woukld be great to utilize the USB Type C port on the Magic Leap.

Thanks in advance for any insights or help.

Unity Editor version: 2022.3.14f1 :
ML2 OS version: 1.5.0 :
MLSDK version: 1.5.0 :
Host OS : MacOS

If this is your first time creating an Android Unity App that communicates with an Arduino, I recommend looking on GitHub and exploring online tutorials to create a standard Android app that implements this functionality. You can run standard Android apps on the Magic Leap as long as they do not require Google Play services and are compiled for the x86_64 platform.

This means you can build a standard Unity Android app and deploy it on the Magic Leap.

Regarding your post, yes, the Android Bluetooth API is the correct way to communicate with Bluetooth devices. The guide you linked outlines this feature, as we do not provide or limit Bluetooth connectivity.

Regarding the USB port, you can use the Android APIs as long as the driver for your device is supported. However, I personally find Bluetooth to be easier.

Since this is regarding a standard Android feature, we do not provide custom documentation or examples. However, I have forwarded your request to our Voice of Customer team.

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.