Hi all,
Can anyone recommend a tutorial on midi up and down bank button or similar.
I have searched for the last couple of days but there seams to be very little out there and some of the examples i have don,t work very well.
iIam quite new to this, and i would like to learn the concept. I have recently learn,t how to assign and turn on and off ccs with a button press also change program number and set up a lcd.
what i would like to do is when the bank up button is pressed it moves the current program up by 4 and when the bank down is pressed it moves it down by 4 from its current program.
Thanks
Can anyone recommend a tutorial on midi up and down bank button or similar...
....what i would like to do is when the bank up button is pressed it moves the current program up by 4 and when the bank down is pressed it moves it down by 4 from its current program.
I don't know what that means.... But, if you can send MIDI messages what's the problem?
Hi
I can send midi messages but, what i want to do is when the bankup button is pressed it moves the program change by 4 so if you are on program 1 and you press the bankup button it moves it to program 5
Arduino IDE File -> Examples -> 02.Digital -> State change detection
Is what you want to look at. On each state change add 4 to a program variable and send it as part of the program change MIDI message. You need to look at both your buttons.
Hi,
I can't get this to change at all if i put a + in front of the current program it changes is it by 5 and doesnt go up any further not sure where the +4 goes. i thought i would get one button working first then get the down button working.
#include <MIDI.h>
#include <midi_Defs.h>
#include <midi_Message.h>
#include <midi_Namespace.h>
#include <midi_Settings.h>
/*
The circuit:
* pushbutton attached to pin 2 from +5V
* 10K resistor attached to pin 2 from ground
* LED attached from pin 13 to ground (or use the built-in LED on
most Arduino boards)
*/
// this constant won't change:
const int buttonPin = 2; // the pin that the pushbutton is attached to
const int ledPin = 13; // the pin that the LED is attached to
// Variables will change:
int bankup = 0; // counter for the number of button presses
int buttonState = 0; // current state of the button
int lastButtonState = 0; // previous state of the button
int currentprog = 0;
MIDI_CREATE_DEFAULT_INSTANCE();
void setup() {
// initialize the button pin as a input:
pinMode(buttonPin, INPUT);
// initialize the LED as an output:
pinMode(ledPin, OUTPUT);
// initialize serial communication:
MIDI.begin();
MIDI.setInputChannel(1);
}
void loop() {
// read the pushbutton input pin:
buttonState = digitalRead(buttonPin);
// compare the buttonState to its previous state
if (buttonState != lastButtonState) {
// if the state has changed, increment the counter
if (buttonState == HIGH) {
// if the current state is HIGH then the button
// wend from off to on:
bankup++;
if(bankup > 127) bankup = 0;
MIDI.sendProgramChange(currentprog+4, 1);
}
else {
digitalWrite(ledPin, LOW);
}
// Delay a little bit to avoid bouncing
delay(20);
}
// save the current state as the last state,
//for next time through the loop
lastButtonState = buttonState;
}
Use bankup += 5 not bankup ++
Thanks mike for the help.