Skip to content

Create a New Project

This tutorial will guide you through creating a new C++ project within the DaisyExamples folder.

Follow along with the video guide!

1. Set Up Your Development Environment

If you haven't already done so, make sure to configure your development environment as described in the Getting Started guide.

2. Install python3

Follow the guide to install python3 for your OS. We will need python3 to run our project helper script later.

Note: Do not install python from the Microsoft store.

3. Using the Helper Script

helper.py is a python script from DaisyExamples that can be used for several helpful utilities.

To create a brand new project containing a Makefile, compilable source file, and debug resources for VisualStudio using VisualGDB, and for VS Code using Cortex Debug:

  • Open a terminal window. On macOS, this is terminal. On Windows, this is git bash (installed in the Getting Started guide).
  • Move into your DaisyExamples folder with cd <DaisyExamples location>.
    • For example, if DaisyExamples is located at C:\\Users\ES\Documents\DaisyExamples, run cd /c/Users/ES/Documents/DaisyExamples.
  • Next, run the helper script for the board you want to target with ./helper.py create MyProjects/<Project Name> --board <Target Board>.
    • For example, if you are creating a project called MyProj for Daisy Patch, you would run ./helper.py create MyProjects/MyProj --board patch.

helper

The <Target Board> option can be any of the following:

To see a full list of available board targets, enter the following command:

./helper.py -h

macOS troubleshooting:

  • Mac users may see Permission denied in the console when trying to run the helper script. A solution to this is to first run chmod +x helper.py
  • Another error that may appear is ImportError: No module named pathlib. A solution is to add "python3" in front of the command, so you will need to run python3 ./helper.py create MyProjects/<Project Name> --board <Target Board>

4. Compiling

  • Open your project in VS Code:
    • Open VS Code.
    • Click File > Open Folder.
    • Choose your project folder. For example, the MyProj folder from 3. Using the Helper Script.
  • Write the code for your example. The default code is a simple passthrough, which you can compile and flash!
  • Build your example with Ctrl-shift-B.
  • If you receive an error related to libDaisy or DaisySP, make sure to build your libs by running task build_all. This will build the libraries.
  • Refer to step 4 of the Development Environment guide for help flashing your project to Daisy.

5. Troubleshooting

Please refer to the Troubleshooting Page.