Go Down

Topic: midi controller (Read 50 times) previous topic - next topic

camilozk

Hi!

I have just done this sketch for a midi controller

I am using just one potentiometer, and I have checked that it works. I wanted to anyway post the code here and see if someone has some advice - suggestion in order to improve the code

:)

Code: [Select]
unsigned char status;
#define midichannel 0;

int sensorValue01;


void setup() {
  Serial.begin(31250);
}

void loop() {
     
  sensorValue01 = analogRead(A0);
  int ccvalue = map(sensorValue01, 0, 1023, 0, 127);
  MIDI_TX(176,0,ccvalue);
}

//*******************************************************************************************************************
// Transmit MIDI Message
//*******************************************************************************************************************
void MIDI_TX(unsigned char MESSAGE, unsigned char PITCH, unsigned char VELOCITY)
{
  status = MESSAGE + midichannel;
  Serial.write(status);
  Serial.write(PITCH);
  Serial.write(VELOCITY);
}

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy