This is the new code... Can someone verify it, please?
#include <MIDI.h>
MIDI_CREATE_DEFAULT_INSTANCE();
// Variables:
int cc = 0;
int AnalogValue = 0; // define variables for the controller data
int lastAnalogValue = 0; // define the "lastValue" variables
void setup() {
// launch MIDI
MIDI.begin(1);
Serial.begin(9600);
}
void loop() {
AnalogValue = analogRead(0);
// convert to a range from 0 to 127:
cc = AnalogValue/8;
// check if analog input has changed
if (lastAnalogValue != cc) {
// update lastAnalogValue variable
lastAnalogValue = cc;
}
} // endif
void MIDImessage(int command, int MIDInote, int MIDIvelocity){
Serial.write(0xB0);
Serial.write(50);
Serial.write(2);}