Use the potentiometer to send Midi CC messages more smoothly.. Help.

- YouTube (video) to show how it is working now..

What do I need to change in my code to make the it move the 'Slider' more smoothly.. up and down.

int note1;
int note2;

void setup()
{
  //  Set MIDI baud rate:
  Serial.begin(31250);  //(31250)
}

void loop()
{
  // Read the input on analog pin 0:
  int PressSensorValue = analogRead(A0);
  int PotSensorValue = analogRead(A1);

  int PressReadings = PressSensorValue / 8;
  int PotReadings = PotSensorValue / 8; 

 // PressReadings = min(PressReadings, 127);
 // PotReadings = min(PotReadings, 127);

 
  noteOnPress(0xB0, 8, PressReadings);
  delay(100);

 
  noteOnPress(0xB0, 88, PotSensorValue);
  delay(100);

// Serial.println(PotReadings);

// Serial.println(PressReadings);


  delay(333);

}

void noteOnPress(int cmd, int pitch, int velocity) {
  Serial.write(cmd);
  Serial.write(pitch);
  Serial.write(velocity);
}

If you keep making new threads I'm going to delete your account.

Please do not cross-post. This wastes time and resources as people attempt to answer your question on multiple threads.

Thread locked.

  • Moderator