Hello everyone,
I built myself a small foot switch so that I can control my Logic Pro x with it.
I used a Raspi Pico that's connected to the computer via USB. The switches work, but I also want the LEDs to indicate when the recording is turned on.
But I can't get the LEDs on or off by Midi- controllers.
With Logic I send e.g. controller 16,25,1 then the LED that is on pin7 would have to be on?
Here is the sketch:
Hallo zusammen,
ich habe mir einen kleinen Fußschalter gebaut, damit ich mein Logic Pro x damit steuern kann.
Benutzt habe ich einen Raspi Pico der über USB am Rechner hängt. Die Schalter funktionieren, aber ich möchte auch, dass die LEDs auch anzeigen, wenn die Aufnahme angeschaltet ist.
ich bekomme es aber nicht hin, dass die LEDs von Controllern ein bzw. ausgeschaltet werden.
Mit Logic sende ich zb Controller 16,25,1 dann müsste doch die LED die am Pin7 hängt angehen?
Hier der Sketch:
// Software für den Bugera -Fußschalter
//Schalter liegen auf A2 bis 5 gegenüber GND
// A2 (ganz rechts) soll sustain pedal sein
// LEDs auf A 6 bis 9
// Falchbandkabel als reserve auf A10 bis 13
// Pullup vs. down erklärt auf https://iwer.info/article/Elektrotechnik/Pullup-Pulldown-Widerstand/index.html
#include <Control_Surface.h> // Include the Control Surface library
// Instantiate a MIDI over USB interface.
USBMIDI_Interface midi;
//Einige Variablen für die gewünschten Controller definieren - die fehlen nämlich in der MIDI_CC Namespace Reference - https://tttapa.github.io/Control-Surface-doc/Doxygen/d4/dbe/namespaceMIDI__CC.html
constexpr uint8_t Control_102 = 0x66; //Für die Schalter
constexpr uint8_t Control_103 = 0x67;
constexpr uint8_t Control_104 = 0x68;
constexpr uint8_t Control_RecordReady = 0x18; //Für die Lampen //24
constexpr uint8_t Control_Recording = 0x19; //25
constexpr uint8_t Control_105 = 0x69;
constexpr uint8_t Control_106 = 0x6A;
constexpr uint8_t Control_107 = 0x6B;
constexpr uint8_t Control_108 = 0x6C;
constexpr uint8_t Control_109 = 0x6D; //für flachbandreserve
constexpr uint8_t Control_110 = 0x6E;
constexpr uint8_t Control_111 = 0x6F;
constexpr uint8_t Control_112 = 0x70;
// Instantiate a CCButton object
CCButton button[]{
// Push button on pin X:
{ 2, { MIDI_CC::Damper_Pedal, Channel_1 } }, // das sustainPedal definieeren
{ 3, { Control_102, Channel_16 } }, //Controller 102
{ 4, { Control_103, Channel_16 } }, //Controller 103
{ 5, { Control_104, Channel_16 } }, //Controller 104
{ 10, { Control_109, Channel_16 } }, //und die Reseerve Flachband
{ 11, { Control_110, Channel_16 } },
{ 12, { Control_111, Channel_16 } },
{ 13, { Control_112, Channel_16 } },
};
//Die lampen sollen auf die Controller ab 105 reagieren, wenn 1 =an, 0=Aus
CCLED leds []{
// { 6, { Control_105, Channel_16 } }, //erste und letzte immer an
{ 7, { Control_Recording, Channel_16 } },
{ 8, { Control_RecordReady, Channel_16 } },
// { 9, { Control_108, Channel_16 } },
};
//lässt die LEDs A 6 bis 9 wild blinken - Funktionskontrolle
void blinky() {
int i, ii;
for (i = 6; i < 10; i++) {
for (ii = 0; ii < 6; ii++) {
digitalWrite(i, HIGH); // turn the LED on (HIGH is the voltage level)
delay(50); // wait for a second
digitalWrite(i, LOW); // turn the LED off by making the voltage LOW
delay(100);
}
}
// und dann alle LEDs an, damit man im dunkeln die tasten trifft
digitalWrite(6, HIGH);
//digitalWrite(7, HIGH);
//digitalWrite(8, HIGH);
digitalWrite(9, HIGH);
}
void setup() {
//Serial.begin(9600);
pinMode(2, INPUT_PULLUP); // Pullup zur Sicherheit einschalten -wird gespeichert - bei jedem Start eigentlich unnötig
pinMode(3, INPUT_PULLUP);
pinMode(4, INPUT_PULLUP);
pinMode(5, INPUT_PULLUP);
pinMode(6, OUTPUT); //Die LEDs initialisieren
pinMode(7, OUTPUT);
pinMode(8, OUTPUT);
pinMode(9, OUTPUT);
pinMode(10, INPUT_PULLUP); // Reserve-Flachbandkabel:Pullup zur Sicherheit einschalten -wird gespeichert - bei jedem Start eigentlich unnötig
pinMode(11, INPUT_PULLUP);
pinMode(12, INPUT_PULLUP);
pinMode(13, INPUT_PULLUP);
blinky();
Control_Surface.begin(); // Initialize Control Surface
}
void loop() {
Control_Surface.loop(); // Update the Control Surface
}