Control two leds with the same midi note. #1117
Unanswered
J4ZZM4N2017
asked this question in
Q&A
Replies: 1 comment
-
|
The way MIDI input handling is implemented, the MIDI message is dispatched only to the first MIDI Input Element that matches. Checking the addresses of all elements would be wasteful. Could you clarify why you need two separate pins for the LEDs? Why not drive them using a single pin (taking into account the current limits of the output drivers, of course)? Finally, the manual |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm trying to do (I thought) a simple thing. Control two LEDs on different pins with the same midi note and button. The button works properly but during midi only one led lights up. I know I'm probably missing something simple that stems from my ignorance. Can someone please advise me?
CODE:
#include <Arduino_Helpers.h>
#include <Control_Surface.h>
#include <AH/Hardware/Button.hpp>
USBMIDI_Interface midi;
Button pushbutton {9};
const pin_t led1Pin = 2;
const pin_t led2Pin = 3;
NoteLED ledgrp [] {
{2, {MIDI_Notes:17, CHANNEL_1}},
{3, {MIDI_Notes:17, CHANNEL_1}},
};
void setup() {
pinMode(led1Pin, OUTPUT);
pinMode(led2Pin, OUTPUT);
pushbutton.begin();
Control_Surface.begin();
}
void loop() {
static bool ledState = LOW;
if (pushbutton.update() == Button::Falling) {
ledState = !ledState;
digitalWrite(led1Pin, ledState ? HIGH : LOW);
digitalWrite(led2Pin, ledState ? HIGH : LOW);
}
Control_Surface.loop();
}
Beta Was this translation helpful? Give feedback.
All reactions