Skip to content

Arduino library for creating Modulove scripts for SyncLFO and A-RYTH-MATIK

License

Notifications You must be signed in to change notification settings

earsneyes/libModulove

 
 

Repository files navigation

Modulove Hardware Abstraction Library

This package provides a library for creating scripts for the Modulove A-RYTH-MATIK eurorack module.

Full Doxyen generated documentation of the library can be found here: https://awonak.github.io/libModulove/.

Installation instructions

There are two ways to install. Include the library directly in your script repo as a git submodule, or download the latest release zip and extract the library into your ~/Arduino/libraries folder.

Include the library as a git submodule to use in your scripts.

In order to include the library source code directly in your repo as a git submodule, you must follow the Arduino Sketch specifications and place the code in the location <sketch>/src/<library>. This is documented in the src subfolder section of the Arduino Sketch Specification.

git submodule add https://github.com/awonak/libmodulove.git <sketch>/src/libmodulove

Download the latest release.

[TODO]

Example usage

#include "src/libmodulove/arythmatik.h"

using namespace modulove;
using namespace arythmatik;

// Declare A-RYTH-MATIK hardware variable.
Arythmatik hw;

byte counter = 0;

void setup() {
    // Initialize the A-RYTH-MATIK peripherials.
    hw.Init();
}

void loop() {
    // Read cv inputs and process encoder state to determine state for this loop.
    hw.ProcessInputs();

    // Advance the counter on CLK input
    if (hw.clk.State() == DigitalInput::STATE_RISING) {
        counter = ++counter % OUTPUT_COUNT;
    }

    // Read encoder for a change in direction and update the counter.
    Encoder::Direction dir = hw.encoder.rotate();
    if (dir == Encoder::DIRECTION_INCREMENT) {
        counter = min(++counter, OUTPUT_COUNT);
    } else if (dir == Encoder::DIRECTION_DECREMENT) {
        counter = max(--counter, 0);
    }

    // Reset the counter back to 0 when encoder switch pressed.
    Encoder::PressType press = hw.encoder.Pressed();
    if (press == Encoder::PRESS_SHORT) {
        counter = 0;
    }

    // Activate the current counter output.
    for (int i = 0; i < OUTPUT_COUNT; i++) {
        (i == counter)
            ? hw.outputs[i].High()
            : hw.outputs[i].Low();
    }

    // Display the current counter step on the OLED.
    hw.display.clearDisplay();
    hw.display.setCursor(SCREEN_HEIGHT/2, 0);
    hw.display.println("Counter: " + String(counter));
    hw.display.display();
}

Third-party Arduino Libraries

About

Arduino library for creating Modulove scripts for SyncLFO and A-RYTH-MATIK

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 100.0%