2013-02-14 02:59:15 +01:00
|
|
|
#include <Wire.h>
|
|
|
|
|
2013-03-12 14:53:27 +01:00
|
|
|
#include <bombatuino_INPUT_MCP23017.h>
|
|
|
|
#include <bombatuino_INPUT_74HC4051.h>
|
|
|
|
#include <bombatuino_ROTARY_ENCODER.h>
|
|
|
|
#include <bombatuino_MIDI.h>
|
2013-02-14 02:59:15 +01:00
|
|
|
|
|
|
|
INPUT_MCP23017 input_MCP23017;
|
|
|
|
INPUT_74HC4051 input_4051;
|
2013-03-12 14:53:27 +01:00
|
|
|
ROTARY_ENCODER rot(incement,decrement);
|
|
|
|
MIDI Midi;
|
2013-02-14 02:59:15 +01:00
|
|
|
|
|
|
|
void setup() {
|
2013-03-12 14:53:27 +01:00
|
|
|
//Serial.begin(9600);
|
|
|
|
Midi.begin();
|
|
|
|
input_MCP23017.begin(0,sendNote);
|
|
|
|
input_4051.begin(A0,11,12,13,sendCC);
|
2013-02-14 02:59:15 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void loop() {
|
|
|
|
input_MCP23017.loop();
|
|
|
|
input_4051.loop();
|
|
|
|
}
|
|
|
|
|
2013-03-12 14:53:27 +01:00
|
|
|
void sendNote(int id, int pin, int value) {
|
|
|
|
if (pin == 15) {
|
|
|
|
rot.setPinB(value);
|
|
|
|
} else
|
|
|
|
if (pin == 14) {
|
|
|
|
rot.setPinA(value);
|
|
|
|
} else {
|
|
|
|
if (value == HIGH) {
|
|
|
|
Midi.noteOn(id*16+pin,MIDI_MAX_DATA);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
//Midi.noteOff(id*16+pin);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void sendCC(int id, int pin, int value) {
|
|
|
|
Midi.controlChange(id*8+pin,value/8);
|
|
|
|
}
|
|
|
|
|
|
|
|
void incement() {
|
|
|
|
Midi.noteOn(16+14,MIDI_MAX_DATA);
|
|
|
|
//Midi.noteOff(16+14);
|
|
|
|
}
|
|
|
|
|
|
|
|
void decrement() {
|
|
|
|
Midi.noteOn(16+15,MIDI_MAX_DATA);
|
|
|
|
//Midi.noteOff(16+15);
|
2013-02-14 02:59:15 +01:00
|
|
|
}
|