Hi guys,
I'm trying to make a simple 'midi controller' with one potentiometer, one button and a white led, using this library on Pro Micro, by following a instructables guide.
The problem is that the project that I'm following doesn't have the led implemented and I'm too newbie to do that by myself.
This 'midi controller' will be mapped for Voice Meeter Banana to control the overall volume on my PC, the potentiometer will be a volume knob and the button will be a mute/un-mute button.
I'm trying to add a white led that will follow the potentiometer, so when the volume is down the light is down and as the volume goes up, the light goes up as well. Eventually I'd like to connect the led to the button too, so when I press the button to mute the channel the led will be off and when I press again to un-mute the channel the led will be back on.
In other words: potentiometer send MIDI and controls the led brightness, button controls the led by turning it on/off with every push.
Here is the sketch:
/*
Sample MIDI Controller using 1-button
Written by: Michael Sobolak
For use with an Arduino Pro Micro
Using MIDI_Controller.h from tttapa
https://github.com/tttapa/MIDI_controller
*/
#include <MIDI_Controller.h> // This lets the microcontroller speak "MIDI"
const uint8_t velocity = 0b1111111; // This sets default velocity to 100% (127 value)
const uint8_t C4 = 60; // Name the note you want to play when the button is pushed(can be anything, C3...D5...E2)
//const uint8_t Csharp4 = 61; // uncomment to use in sketch (cannot use "#" in sketch, use "sharp" instead)
//const uint8_t D4 = 62; // uncomment to use in sketch
Digital button1(2, C4, 1, velocity); // Format is this: button[number] (pin, note, channel, velocity)
//Digital button2(3, Csharp4, 1, velocity); // uncomment to use in sketch
//Digital button3(4, D4, 1, velocity); //uncomment to use in sketch
Analog potentiometer1(A0, MIDI_CC::Channel_Volume, 1);
//Analog potentiometer2(A1, MIDI_CC::Pan, 1); // uncomment to use in sketch
//Analog potentiometer3(A2, MIDI_CC::Effect_Control_1, 1); // uncomment to use in sketch
void setup() {
// put your setup code here, to run once: nothing to put here this time
}
void loop() {
// put your main code here, to run repeatedly:
MIDI_Controller.refresh();
}
This is my first ever arduino project, so be kind with me. I've tried to follow other projects that have multiple led's and write some code lines but it was total fail.
I'm pretty sure this can be done so easy by somebody who's more experienced.
Thank you very much! I hope somebody can help me with the right code for this.