Professional Documents
Culture Documents
Forum Arduino CC Index PHP Topic 187364 0
Forum Arduino CC Index PHP Topic 187364 0
cc SIGN IN
Arduino Forum > Using Arduino > Audio > MIDI CONTROLLER - Turn LEDs on with MIDI messages!
HAR D WAR E
Topic: MIDI CONTROLLER - Turn LEDs on with MIDI messages! (Read 5087 times) Previous Topic - Next Topic
Code: [Select]
#define boton1 51
#define boton1led 50
int keyispressed1 = 0;
int noteisplaying1 = 0;
🍪
void setup() {
Serial.begin (115200);
We use cookies pinMode(boton1, INPUT);
Our websites use cookies (also from third parties) for functional and( I took off the MIDI out part for give you a shorter code )
analytical purposes, and to show you personalised advertisement. You can
adjust this in Cookie Settings or learn more by reading our cookie But
policy.
also, if the button I pressed has a toggle function in the software (like "Play", something
that still activated after "un-
press"), I want to send a message from the software (I tried and it's possible) and somehow get the LED still on. (Sorry for
my bad english, this is very hard to explain hahaha).
ONLY REQUIRED ACCEPT ALL
The software can send:
A "note on" with velocity "127" when the function is activated, and velocity "0" when is desactivated.
Also, it can send a "Control Change" with same configuration of velocity.
I tried with reading "raw" serial and with the MIDI Library too, but I don't get it working...
Code: [Select]
byte message;
byte note;
byte velocity;
int led = 13;
void setup() {
pinMode(led,OUTPUT);
Serial.begin(115200);
digitalWrite(led,LOW);
Code: [Select]
#include <MIDI.h>
void setup() {
pinMode(led, OUTPUT);
Serial.begin(115200);
}
Code: [Select]
if (Serial.available() > 0) {
Brattain Member
message = Serial.read();
Posts: 62,883
note = Serial.read();
velocity = Serial.read();
Karma: 2521 [add]
Solder is electric glue
http://www.thebox.myzen.c So if one byte is available to read you go ahead and read three bytes. See anything wrong in that?
o.uk
❝
Code: [Select]
if (Serial.available() > 0) {
message = Serial.read();
note = Serial.read();
velocity = Serial.read();
So if one byte is available to read you go ahead and read three bytes. See anything wrong in that?
Thank you! Now the midi in works great! That was easy hahaha
But I've a problem implementing the default "LED on while button is pressed" with the MIDI in from software.
If I activate the control from my computer, the software send the message and LED turn on. But if I press the button,
and the message comes in while LED is on by default, when I "unpress" the button the LED just turn off.
Do you understand me? How can this be solved?
Code: [Select]
byte message;
byte note;
byte velocity;
int keyispressed1 = 0;
Thank you!
I need something like a buffer that store the action of 'turn on LED when the midi message arrives' until I release the
button, don't?
How can it be done?
Quote
❝ But I've a problem implementing the default "LED on while button is pressed" with the MIDI in from software.
Brattain Member If I activate the control from my computer, the software send the message and LED turn on. But if I press the button, and the message
Posts: 62,883 comes in while LED is on by default, when I "unpress" the button the LED just turn off.
Karma: 2521 [add]
Sorry but no I don't understand.
Solder is electric glue What is meant by on by default?
http://www.thebox.myzen.c How does it get into that state.
o.uk You seam to have an inconsistency in your logic. If a released button turns off an led what is the thing that turns it off
when it is on by default?
❝
Full Member Quote
Posts: 169
Karma: 31 [add] ❝ But I've a problem implementing the default "LED on while button is pressed" with the MIDI in from software.
If I activate the control from my computer, the software send the message and LED turn on. But if I press the button, and the
message comes in while LED is on by default, when I "unpress" the button the LED just turn off.
If I understood well, when the arduino is receiving midi messages he wants a note off message to turn off the led, and not
the button.
I suppose he could use a flag so when it's receiving midi messages the button off part with doesn't happens... I don't
understand why he's receiving midi messages from the daw. Something like this? http://www.youtube.com/watch?
v=Ztw-4VHIQaQ
I think I need a buffer for save the message until I release the button.
Please forgive me if I can't explain it very well, it's so hard in English for me!
Go Up Pages: [1]
PRINT
Jump to:
=> Audio Go
B a ck t o t o p
C o n t a ct U s
Enter your email to sign up S UBS C RIBE
D i st ri b u t o rs
C a re e rs
© 2021 A rd u i n o Te rm s O f S e rv i ce P ri v a cy P o l i cy S e cu ri t y Co o k ie Settin gs