SchwurblerControllers is an Arduino library to easily setup a different Controller for your Midi Controller
include all you want to use
Triggervalue on/off
- ButtonController
#include <ButtonController.h>
- PotiController
analog Value
#include <PotiController.h>
- RotaryController
digital angle Value
not ready to use now
#include <RotaryController.h>
Outside of the setup and loop functions you define but do not initialze all your controllers. We need to define a pointer variable from the descired Controllers.
PotiController* potiController;
Inside the setup function you shall init all your controllers
ButtonController buttonController = ButtonController();
That's it. We decided to go simple stupid. For sure if you are a dev too you might want to fight with pointers and memory. But as this Library is intended for fotographs completly regardless if they can read on line of code or not. Everything get's configured with #define - That's too easy. Just have an eye on this file https://github.com/mommel/schwurblerControllers/blob/master/include/SchwurblerController.h Everything is defined there. If you wanr to customize just copy the decired lines to your main.cpp and your are good to go.
This will result in a setup of 3 Potis
- Poti 1 sends Key 0 listens on Pin 1
- Poti 2 sends Key 1 listens on Pin 2
- Poti 3 sends Key 2 listens on Pin 3
You need to loop over the pins to set them as INPUT_PULLUP As all are already defined you can loop over the controller
for (int controllerID = 0; controllerID < buttonController->getAmount();
controllerID++) {
pinMode(buttonController->getPin(controllerID), INPUT_PULLUP);
}
You check which type the Controller awaits and create one with the name of your choise and link that funktionname later to the Controller
create a function to be called with a params
- int inControlNumber the Midi key to send
- bool isActive desctibes if it's the push or release event
void SendMidiTrigger(int inControlNumber, bool isActive) {
if (isActive) {
usbMIDI.sendNoteOn(inControlNumber, kOnVelocity, kMidiChannel);
} else {
usbMIDI.sendNoteOff(inControlNumber, 0, kMidiChannel);
}
}
Link the callback to the Controller
buttonController->handleMidiTriggerCallback(&SendMidiTrigger);
create a function to be called with a params
- int inControlNumber the Midi key to send
- byte the meassured value of the input
void sendMidiValueChange(int inControlNumber, byte controllerValue) {
usbMIDI.sendControlChange(inControlNumber, controllerValue, kMidiChannel);
}
Link the callback to the Controller
potiController->handleMidiTriggerCallback(&sendMidiValueChange);
buttonController->getData();
like any other Arduino library
see doc
The controllers use 3rd party libraries, that are not included but marked as dependencies. Those libraries have their own licences and are not touched by the library used by SchwurblerControllers
We like to thank dxinteractive for ResponsiveAnalogRead, mathertel for RotaryEncoder and thomasfredericks for Bounce2
This program is free software; you can redistribute it and/or modify it under the terms of the (CC BY-NC-SA 4 0) Creative Commons Attribution-NonCommercial-ShareAlike 4 0 International as published by Creative Commons Corporation; either version 4 of the License, or (at your option) any later version
DISCLAIMER THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE