Skip to content

How To Create a New Project

takumi-ogata edited this page Feb 27, 2023 · 4 revisions

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

Follow along with the video guide!

Steps

1. Set Up Your Development Environment

If you haven't already done so, make sure to configure your development environment as described in the Setting Up Your Development Environment wiki page.

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. ./helper.py create MyProjects/<Project Name> --board <Target Board>
    • For example, if we are creating a project called MyProj for the Daisy Patch, we would
      run ./helper.py create MyProjects/MyProj --board patch

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 step 3.
  • Write the code for your example.
    (The default code is a simple passthrough, you can try compiling and flashing it!).
  • 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 3 of the Development Environment guide for help flashing your project to the Daisy.

5. Troubleshooting

Please refer to the troubleshooting page.