/joulescope_driver_c_template

Template project for creating a Joulescope Driver C executable

Primary LanguageCApache License 2.0Apache-2.0

Joulescope Driver C Template

This project contains a template to get you started writing a custom C program using the Joulescope driver.

Getting started

The general process is:

  1. Install local build tools.
  2. Fork this project on GitHub and clone locally.
  3. Build the example.
  4. Run the example. It should display statistics from a connected JS220.
  5. Modify CMakeLists.txt with your project name (executable name) and version.
  6. Modify src/main.c to become your desired program.
  7. [optional] Push to a new GitHub repo or private repo.

Install local build tools

The recommended tools are:

  1. git (to clone the repo, but can just download to skip this step)
  2. cmake
  3. C compiler

Windows: download the binaries for git and cmake using the links above. Install them. Then install Visual Studio 2022 Community. Select the "Desctop development with C++" workload which includes the latest MSVC and Windows SDK.

macOS: we recommend homebrew](https://brew.sh/). Follow the installation instructions, and then brew install git cmake

Ubuntu: sudo apt install git cmake build-essential

Fork and clone

At a command line, type:

cd <YOUR_BASE_PATH>
git clone https://github.com/jetperch/joulescope_driver_c_template.git <YOUR_PROJECT_NAME>
cd <YOUR_PROJECT_NAME>
git submodule init
git submodule update

You should also edit the project name and version in CMakeLists.txt.

Build the example

Use cmake to configure the build system:

cd <YOUR_BASE_PATH>/<YOUR_PROJECT_NAME>
mkdir build
cd build
cmake ..

From then on, from the project directory, build using:

cmake --build build

You can then run the executable:

Windows: .\build\src\Debug<project_name>

macOS and Ubuntu: ./build/src/Debug/<project_name>