-
Notifications
You must be signed in to change notification settings - Fork 0
/
UsbMidiWah.ino
31 lines (26 loc) · 1.16 KB
/
UsbMidiWah.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include "Input.hpp"
/* ======================================= CONFIG ====================================== */
/* Add new Analog or Digital input objects here and add them to the inputs array. */
/* For a list of midi commands see: */
/* https://www.midi.org/specifications/item/table-3-control-change-messages-data-bytes-2 */
/* ===================================================================================== */
/* Pin P2 = 1 for analog readings, Midi command "Expression Controller" = 0x0B */
static AnalogInput poti(1, 0x0B);
/* Pin P0 = 0, Use internal Pullup resistor, DebounceDelay = 50ms, Midi command "Soft Pedal On/Off" = 0x43 */
static DigitalInput onOffSwitch(0, INPUT_PULLUP, 50, 0x43);
Input * const inputs [] = {
(Input*)&poti,
(Input*)&onOffSwitch
};
void setup() {
/* Iterate over list of inputs and initialize */
for( unsigned int i = 0; i < sizeof(inputs)/sizeof(inputs[0]); i++ ) {
inputs[i]->initialize();
}
}
void loop() {
/* Iterate over list of inputs and process */
for( unsigned int i = 0; i < sizeof(inputs)/sizeof(inputs[0]); i++ ) {
inputs[i]->process();
}
}