Building Apps
Getting started with AR Studio for VSCode
AR Studio for VSCode lets you develop, test and save apps directly onto your Monocle. Download it today from the VSCode Marketplace and start developing your Monocle projects.
- Once installed, connect to Monocle with
Ctrl-Shift-P
→Brilliant AR Studio: Connect
. - Copy the example below, and save the file as
main.py
.
import touch
import display
def change_text(button):
new_text = display.Text(f"Button {button} touched!", 0, 0, display.WHITE)
display.show(new_text)
touch.callback(touch.EITHER, change_text)
initial_text = display.Text("Tap a touch button", 0, 0, display.WHITE)
display.show(initial_text)
- Upload
main.py
by right clicking on the file in the Explorer and clickingBrilliant AR Studio: Upload File to Device
. Ensure that you have a workspace or folder open in the Explorer so that you can see the file. - When prompted for the on-device name, keep it as
main.py
and press Enter. - Run main.py with
Ctrl-Shift-P
→Brilliant AR Studio: Build
. - You should be able to touch each of the touch pads on Monocle, and see the display update.
Connecting to the wider world
MicroPython on Monocle simplifies the usage of complex protocols typically employed in Bluetooth devices. Just like Python on desktop, Monocle can be conveniently interacted with using the REPL (Read Evaluate Print Loop) interface. The key difference? It’s completely wireless!
This wireless functionality not only allows for effortless testing and application development on Monocle, but also enables Python commands to control Monocle from your customized iOS, Android, or Desktop app.
Below are some templates to help you get started building your own apps.
iOS & Android
Noa is our ChatGPT client for Monocle. Check out the source code for iOS, as well as for Android and use it as a template for your own mobile app.
Javascript
The WebREPL is a good starting point building your own web apps. Try it from Google Chrome on your PC, Mac, Android, or a Web Bluetooth compatible web browser on your iOS device such as Bluefy.
Check out the full instructions and the source code here.
Community projects
For more application examples and ideas, check out the community projects section to see what others have built.