This repository provides a Visual Studio Code workspace template for developing projects with the Arduino Uno Q microcontroller (without needing Arduino App Lab). It includes configurations and tasks to streamline the development process. Note that this is in early stages and mainly something I have put together for my own use, but can be useful for others as well. It might require some adjustments based on your specific setup (has been used on Linux).
Enables writing the Arduino sketch and Python code for Uno Q apps in VS Code. This enables:
- Faster compile and upload cycles by compiling sketches locally and only flashing when changes are detected.
- IntelliSense for Arduino C++ code using Arduino CLI installed libraries.
- Local linting of Python code using a virtual environment with necessary dependencies.
- Predefined tasks for common actions like starting/stopping the app, viewing logs, and more.
- Usage of VS Code extensions.
- Clone or download this repository to get the .vscode folder. This contains the scripts for the different tasks.
- Place this folder in a directory where you want to create your Arduino Uno Q project.
- Open the directory in Visual Studio Code.
- Run the task
Initialize New Arduino App Projectwhich will set up multiple things:- Create an
appfolder for your App (arduino sketch and Python code). - Creates a python virtual environment with base dependencies for Uno Q development to enable local linting.
.vscode/c_cpp_properties.jsonis configured to use the Arduino CLI installed libraries for IntelliSense (arduino-cli has to be installed separately).- Tip: You might have to reload the VS Code window after this step for IntelliSense to work properly (Ctrl+Shift+P, then "Reload Window").
- Note: If you already have an app folder (or copied the whole repo), you can skip this step and just configure the python virtual environment with the task
Setup local Python environment.
- Create an
- Start coding your Arduino sketch in
app/sketchand your Python code inapp/python. - Code can be uploaded to the Uno Q with the task
Fast deploy and run(Ctrl+Shift+B). This task performs multiple actions to enable fast development cycles:- It checks if the Arduino sketch has changed since the last upload using a hash comparison. If it has changed, it locally compiles and uploads the sketch to the Uno Q.
- It pushes the Python code to the Uno Q.
- It restarts the app on the Uno Q to run the updated code.
- Additional tasks are available for individual actions like viewing the Serial Monitor (Monitor output from the microcontroller), viewing Python logs, starting/stopping the app and more.
- Visual Studio Code
- Arduino CLI installed and configured
- ADB (Android Debug Bridge) installed for communication with the Uno Q
- uv python package manager to create the virtual environment
- Bash shell for running the provided scripts
- C/C++ Extension pack
- Python
- Currently tested on Linux only.
- In order to avoid the Uno Q compiling the sketch again after the local compile and flashing has been performed, the sketch folder is not copied to the device like normal (it is copied under /hidden/ as reference). This is a workaround for how
arduino-app-cli app startworks currently (it wont find the sketch and therefore not compile and flash it) but also means that the Uno Q won't flash the sketch again on its own (if the app is started again later with another app running inbetween). It would be nicer to have a more elegant solution for this in the future. - If another app is started on the Uno Q, the script wont be able to stop or start a new app. This can be worked around by manually stopping the app first using
adb shell arduino-app-cli app stop PATH_TO_RUNNING_APPbefore running the tasks again (or stopping from Arduino App Lab). - Uses ADB for now which is fast, further setup can enable wireless deployment (Modification of scripts to use SSH should be fairly straightforward).
- More robust error handling.
- Automatic setup of local Arduino CLI environment.
- Further testing.
- A guide on using the Arduino App CLI (which is heavily used in the scripts): https://shawnhymel.com/3074/how-to-use-the-command-line-cli-with-the-arduino-uno-q/
- Tip: You can reach the Uno Q's shell by running
adb shellin a terminal with ADB installed and the Uno Q connected. From there you can explore the file system and run commands (e.g.arduino-app-clicommands).
- Tip: You can reach the Uno Q's shell by running