Greetings. I am a new Arduino user and am using the mega board. I am trying to create a midi controller with 4 buttons, 1 fader/poteniometer and 12 Rotary Encoders. I have been able to set up the fader and the buttons without any issues and they upload fine and work. I have been playing around with the code but I cannot get it to work with more than one encoder. How can I fix this code to be able to add the 12 encoders and have the code upload successfully to the Arduino? The code is pasted below.
#include <Control_Surface.h> // Include the Control Surface library
// Instantiate a MIDI over USB interface.
HairlessMIDI_Interface midi;
// Instantiate a CCAbsoluteEncoder object
CCAbsoluteEncoder enc {
{9, 10}, // pins
MIDI_CC::Pan // MIDI address (CC number + optional channel)
// optional multiplier if the control isn't fast enough
};
using namespace MIDI_Notes;
// Instantiate the momentary push buttons that send out MIDI Note events.
NoteButton buttons[ ] = {
{A5, note(C, 4)}, // digital input pin, note number
{A6, note(Db, 4)},
{A7, note(D, 4)},
{A8, note(B, 4)},
// If you want to set the channel specifically, you can use:
// {2, {note(C, 4), CHANNEL_1}},
};
// Instantiate a CCPotentiometer object
CCPotentiometer potentiometer {
A7, // Analog pin connected to potentiometer
{MIDI_CC::Channel_Volume, CHANNEL_1}, // Channel volume of channel 1
};
void setup() {
Control_Surface.begin(); // Initialize Control Surface
}
void loop() {
Control_Surface.loop(); // Update the Control Surface
}Preformatted text