Réaction potentiometre

Bonjour à tous

J'ai une réponse bizarre de mes potentiomètres et je voulais savoir s'il était possible de régler ce soucis par le code. Je m'explique

Je me suis donc fait un contrôleur midi pour utiliser Traktor et Ableton, avec potentiomètre, encodeur, led etc. Tout fonctionne correctement sauf que quand mes potentiomètres (a glissière ou rotatif) font la moitié de leur course sur le contrôleur, ils ont déjà fait 100% de leur course sur le logiciel.
Pour être plus précis j'ai des 280° sur contrôleur, qui contrôlent des potentiomètres 280° sur le logiciel. Course de 7heure à 5heure. quand je pars de 0% de la course donc 7h , le logiciel réagit quasi instantanément dés que je commence à tourner le potentiomètre.
__Quand j'arrive environ en position 10h, je suis déjà à 12h sur le logiciel.
__Quand j'arrive environ en position 12h, je suis déjà à 5h sur le logiciel. (100% de la course).

Et forcement quand je pars de 100% de la course donc 5h, le logiciel ne réagit que quand j'atteins 12h sur le potentiomètre.

Autre chose, quand j'arrive en buté des 100% de rotation (exemple avec le contrôler35 qui atteint les 127), ça m'envoie des infos aléatoires. c'est uniquement quand je suis en butée, sinon ça le fait pas.

voici le code.

#include <Control_Surface.h>  // Include the Control Surface library
#include <MIDIUSB.h> // Include The MIDIUSB Library
#include <Encoder.h> // Include the Encoder library.


USBMIDI_Interface midi;  // Instantiate a MIDI Interface to use
 
// Instantiate an analog multiplexer
CD74HC4067 mux1 {
  A0,       // Analog input pin
  {18, 19, 20, 21} // Address pins S0, S1, S2, S3
};
// Instantiate another analog multiplexer
CD74HC4067 mux2 {
  16,       // digital input pin
  {18, 19, 20, 21} // Address pins S0, S1, S2, S3
};

// Instantiate an analog multiplexer
CD74HC4067 mux3 {
  17,       // digital input pin
  {18, 19, 20, 21} // Address pins S0, S1, S2, S3
};

// Instantiate first shift register as output for the LEDs
SPIShiftRegisterOut<8> sreg1 {
  SPI,      // SPI interface to use
  52,       // Latch pin (ST_CP)
  MSBFIRST, // Byte order
};

// Instantiate second shift register as output for the LEDs
SPIShiftRegisterOut<8> sreg2 {
  SPI,      // SPI interface to use
  53,       // Latch pin (ST_CP)
  MSBFIRST, // Byte order
};

///////////////////////////  POTENTIOMETERS  /////////////////////////////

// Create an array of CCPotentiometer objects that send out MIDI Control Change 
// messages when you turn the potentiometers connected to the 16 inputs of the mux.
CCPotentiometer Potentiometers[] {
// Mux number.Pin(Number), CC number, MIDI Channel
  { mux1.pin(0), { 0x01, CHANNEL_1 } }, // Dry/Wet Adjust Effect DECK A
  { mux1.pin(1), { 0x02, CHANNEL_1 } }, // Effect Knob 1 DECK A
  { mux1.pin(2), { 0x03, CHANNEL_1 } }, // Effect Knob 2 DECK A
  { mux1.pin(3), { 0x04, CHANNEL_1 } }, // Effect Knob 3 DECK A
  { mux1.pin(4), { 0x05, CHANNEL_1 } }, // Gain Deck A (Bitwig)
  { mux1.pin(5), { 0x06, CHANNEL_1 } }, // Headphone Gain Deck A (Bitwig)
  { mux1.pin(6), { 0x07, CHANNEL_1 } }, // Low Cut Deck A (Bitwig)
  { mux1.pin(7), { 0x08, CHANNEL_1 } }, // SculptEQ Freq Deck A (Bitwig)
  { mux1.pin(8), { 0x09, CHANNEL_1 } }, // SculptEQ Gain Deck A (Bitwig)
  { mux1.pin(9), { 0x10, CHANNEL_1 } }, // High Cut Deck A (Bitwig)
  { mux1.pin(10), { 0x11, CHANNEL_1 } }, // Send 1 Deck A (Bitwig)
  { mux1.pin(11), { 0x12, CHANNEL_1 } }, // Send 2 Deck A (Bitwig)
  { mux1.pin(12), { 0X13, CHANNEL_1 } }, // Fader Deck A (Bitwig)
  { mux1.pin(13), { 0x14, CHANNEL_1 } }, // Dry/Wet Adjust Effect DECK C
  { mux1.pin(14), { 0x15, CHANNEL_1 } }, // Effect Knob 1 DECK C
  { mux1.pin(15), { 0x16, CHANNEL_1 } }, // Effect Knob 2 DECK C
  
};

CCPotentiometer potentiometers[] {
// Pin Number, CC Number, MIDI Channel Number  
  {A1, { 0x17, CHANNEL_1 } }, // Effect Knob 3 DECK C
  {A2, { 0x18, CHANNEL_1 } }, // Gain Deck C (Bitwig)
  {A3, { 0x19, CHANNEL_1 } }, // Headphone Gain Deck C (Bitwig)
  {A4, { 0x20, CHANNEL_1 } }, // Low Cut Deck C (Bitwig)
  {A5, { 0x21, CHANNEL_1 } }, // SculptEQ Frequency Deck C (Bitwig)
  {A6, { 0x22, CHANNEL_1 } }, // SculptEQ Gain Deck C (Bitwig)
  {A7, { 0x23, CHANNEL_1 } }, // High Cut Deck C (Bitwig)
  {A8, { 0x24, CHANNEL_1 } }, // Send 1 Deck C (Bitwig)
  {A9, { 0x25, CHANNEL_1 } }, // Send 2 Deck C (Bitwig)
  {A10, { 0x26, CHANNEL_1 } }, // Fader Deck C (Bitwig)
  {A11, { 0x27, CHANNEL_1 } }, // Master Volume

};

///////////////////////////  MOMENTARY SWITCH  /////////////////////////////

NoteButton Buttons[] {
// Mux number.Pin(Number), MIDI note Number, MIDI Channel
  { mux2.pin(0), { MIDI_Notes::Ab(-1), CHANNEL_1 } }, // Unit On FX1 DECK A
  { mux2.pin(1), { MIDI_Notes::A(-1), CHANNEL_1 } }, // FX1 Select & Load DECK A
  { mux2.pin(2), { MIDI_Notes::Bb(-1), CHANNEL_1 } }, // FX2 Select & Load DECK A
  { mux2.pin(3), { MIDI_Notes::B(-1), CHANNEL_1 } }, // FX3 Select & Load DECK A
  { mux2.pin(4), { MIDI_Notes::C(-1), CHANNEL_1 } }, // FX4 Select & Load DECK A
  { mux2.pin(5), { MIDI_Notes::Db(-1), CHANNEL_1 } }, // Button FX Knob 1 DECK A
  { mux2.pin(6), { MIDI_Notes::D(-1), CHANNEL_1 } }, // Button FX Knob 2 DECK A
  { mux2.pin(7), { MIDI_Notes::Eb(-1), CHANNEL_1 } }, // Button FX Knob 3 DECK A
  { mux2.pin(8), { MIDI_Notes::E(-1), CHANNEL_1 } }, // Set As Tempo Master DECK A
  { mux2.pin(9), { MIDI_Notes::F_(-1), CHANNEL_1 } }, // Sync DECK A
  { mux2.pin(10), { MIDI_Notes::Gb(-1), CHANNEL_1 } }, // Play/Pause DECK A
  { mux2.pin(11), { MIDI_Notes::G(-1), CHANNEL_1 } }, // Cue DECK A
  { mux2.pin(12), { MIDI_Notes::Ab(0), CHANNEL_1 } }, // Headphone On DECK A (Bitwig)
  { mux2.pin(13), { MIDI_Notes::A(0), CHANNEL_1 } }, // BeatJump Backward DECK A
  { mux2.pin(14), { MIDI_Notes::Bb(0), CHANNEL_1 } }, // BeatJump Forward DECK A
  { mux2.pin(15), { MIDI_Notes::B(0), CHANNEL_1 } }, 
  { mux3.pin(0), { MIDI_Notes::C(0), CHANNEL_1 } }, // Unit On FX1 DECK C
  { mux3.pin(1), { MIDI_Notes::Db(0), CHANNEL_1 } }, // FX1 Select & Load DECK C
  { mux3.pin(2), { MIDI_Notes::D(0), CHANNEL_1 } }, // FX2 Select & Load DECK C
  { mux3.pin(3), { MIDI_Notes::Eb(0), CHANNEL_1 } }, // FX3 Select & Load DECK C
  { mux3.pin(4), { MIDI_Notes::E(0), CHANNEL_1 } }, // FX4 Select & Load DECK C
  { mux3.pin(5), { MIDI_Notes::F_(0), CHANNEL_1 } }, // Button FX Knob 1 DECK C
  { mux3.pin(6), { MIDI_Notes::Gb(0), CHANNEL_1 } }, // Button FX Knob 2 DECK C
  { mux3.pin(7), { MIDI_Notes::G(0), CHANNEL_1 } }, // Button FX Knob 3 DECK C
  { mux3.pin(8), { MIDI_Notes::Ab(1), CHANNEL_1 } }, // Set As Tempo Master DECK C
  { mux3.pin(9), { MIDI_Notes::A(1), CHANNEL_1 } }, // Sync DECK C
  { mux3.pin(10), { MIDI_Notes::Bb(1), CHANNEL_1 } }, // Play/Pause DECK C
  { mux3.pin(11), { MIDI_Notes::B(1), CHANNEL_1 } }, // Cue DECK C
  { mux3.pin(12), { MIDI_Notes::C(1), CHANNEL_1 } }, // Headphone On DECK C (Bitwig)
  { mux3.pin(13), { MIDI_Notes::Db(1), CHANNEL_1 } }, // BeatJump Backward DECK C
  { mux3.pin(14), { MIDI_Notes::D(1), CHANNEL_1 } }, // BeatJump Forward DECK C
  { mux3.pin(15), { MIDI_Notes::Eb(1), CHANNEL_1 } },
};

NoteButton Button[] {
// Pin Number, MIDI note Number, MIDI Channel
  {40, {MIDI_Notes::E(1), CHANNEL_1} }, // Load Deck C
  {41, {MIDI_Notes::F_(1), CHANNEL_1} }, // Loop Size Select & Set 16, Size Selector Loop, Move Selector Loop Deck C
  {42, {MIDI_Notes::Gb(1), CHANNEL_1} }, // Loop Active Deck C
  {43, {MIDI_Notes::G(1), CHANNEL_1} }, // Load Deck A
  {44, {MIDI_Notes::Ab(2), CHANNEL_1} }, // Loop Size Select & Set 16, Size Selector Loop, Move Selector Loop Deck A
  {45, {MIDI_Notes::A(2), CHANNEL_1} }, // Loop Active Deck A

};
///////////////////////////  LED  /////////////////////////////

// Instantiate the LED that will light up when corresponding MIDI Note is playing
NoteLED leds[] {
// Pin Number, MIDI Note, MIDI channel 
  {22, {MIDI_Notes::Bb(2), CHANNEL_1} }, // FX On Deck A
  {23, {MIDI_Notes::B(2), CHANNEL_1} }, // FX1 Select & Load Deck A
  {24, {MIDI_Notes::C(2), CHANNEL_1} }, // FX2 Select & Load Deck A
  {25, {MIDI_Notes::Db(2), CHANNEL_1} }, // FX3 Select & Load Deck A
  {26, {MIDI_Notes::D(2), CHANNEL_1} }, // FX4 Select & Load Deck A
  {27, {MIDI_Notes::Eb(2), CHANNEL_1} }, // Button FX Knob 1 Deck A
  {28, {MIDI_Notes::E(2), CHANNEL_1} }, // Button FX Knob 2 Deck A
  {29, {MIDI_Notes::F_(2), CHANNEL_1} }, // Button FX Knob 3 Deck A
  {30, {MIDI_Notes::Gb(2), CHANNEL_1} }, // Set As Tempo Master Deck A
  {31, {MIDI_Notes::G(2), CHANNEL_1} }, // Sync Deck A
  {32, {MIDI_Notes::Ab(3), CHANNEL_1} }, // Play/Pause DECK A
  {33, {MIDI_Notes::A(3), CHANNEL_1} }, // Cue DECK A
  {34, {MIDI_Notes::Bb(3), CHANNEL_1} }, // Headphone On DECK A (Bitwig)
  {35, {MIDI_Notes::B(3), CHANNEL_1} }, // BeatJump Backward DECK A
  {36, {MIDI_Notes::C(3), CHANNEL_1} }, // BeatJump Forward DECK A
  {37, {MIDI_Notes::Db(3), CHANNEL_1} }, // Loop Size Select & Set 16, Size Selector Loop, Move Selector Loop Deck A
  {38, {MIDI_Notes::D(3), CHANNEL_1} }, // Loop Active Deck A
  {39, {MIDI_Notes::Eb(3), CHANNEL_1} }, // Loop Size Select & Set 16, Size Selector Loop, Move Selector Loop Deck C

};

// Create an array of LEDs that listen to MIDI Note messages, turning on and off
// the LEDs connected to the eight output pins of the shift register
NoteLED led[] {
// sregpin number, note number, channel
  {sreg1.pin(0), {MIDI_Notes::E(3), CHANNEL_1} }, // Loop Active Deck C
  {sreg1.pin(1), {MIDI_Notes::F_(3), CHANNEL_1} }, // FX On Deck C 
  {sreg1.pin(2), {MIDI_Notes::Gb(3), CHANNEL_1} }, // FX1 Select & Load Deck C
  {sreg1.pin(3), {MIDI_Notes::G(3), CHANNEL_1} }, // FX2 Select & Load Deck C
  {sreg1.pin(4), {MIDI_Notes::Ab(4), CHANNEL_1} }, // FX3 Select & Load Deck C
  {sreg1.pin(5), {MIDI_Notes::A(4), CHANNEL_1} }, // FX4 Select & Load Deck C
  {sreg1.pin(6), {MIDI_Notes::Bb(4), CHANNEL_1} }, // Button FX Knob 1 DECK C
  {sreg1.pin(7), {MIDI_Notes::B(4), CHANNEL_1} }, // Button FX Knob 2 DECK C
  {sreg2.pin(0), {MIDI_Notes::C(4), CHANNEL_1} }, // Button FX Knob 3 DECK C
  {sreg2.pin(1), {MIDI_Notes::Db(4), CHANNEL_1} }, // Set As Tempo Master Deck C
  {sreg2.pin(2), {MIDI_Notes::D(4), CHANNEL_1} }, // Sync Deck C
  {sreg2.pin(3), {MIDI_Notes::Eb(4), CHANNEL_1} }, // Play/Pause DECK C
  {sreg2.pin(4), {MIDI_Notes::E(4), CHANNEL_1} }, // Cue DECK C
  {sreg2.pin(5), {MIDI_Notes::F_(4), CHANNEL_1} }, // Headphone On DECK C (Bitwig)
  {sreg2.pin(6), {MIDI_Notes::Gb(4), CHANNEL_1} }, // BeatJump Backward DECK C
  {sreg2.pin(7), {MIDI_Notes::G(4), CHANNEL_1} }, // BeatJump Forward DECK C
};

///////////////////////////  ROTARY ENCODERS  /////////////////////////////

CCRotaryEncoder enc1 = { //Load & Search DECK A
  {0, 1},       // pins
  100, // MIDI address (CC number + optional channel)
  1,            // optional multiplier if the control isn't fast enough
};

CCRotaryEncoder enc2 = { // Loop Size DECK A
  {2, 3},       // pins
  101, // MIDI address (CC number + optional channel)
  1,            // optional multiplier if the control isn't fast enough
};

CCRotaryEncoder enc3 = { // Loop Move DECK A
  {4, 5},       // pins
  102, // MIDI address (CC number + optional channel)
  1,            // optional multiplier if the control isn't fast enough
};

CCRotaryEncoder enc4 = { // Cue Jump DECK A
  {6, 7},       // pins
  103, // MIDI address (CC number + optional channel)
  1,            // optional multiplier if the control isn't fast enough
};

CCRotaryEncoder enc5 = { //Load & Search DECK C
  {8, 9},       // pins
  104, // MIDI address (CC number + optional channel)
  1,            // optional multiplier if the control isn't fast enough
};

CCRotaryEncoder enc6 = { // loop Size DECK C
  {10, 11},       // pins
  105, // MIDI address (CC number + optional channel)
  1,            // optional multiplier if the control isn't fast enough
};

CCRotaryEncoder enc7 = { // Loop Move DECK C
  {12, 13},       // pins
  106, // MIDI address (CC number + optional channel)
  1,            // optional multiplier if the control isn't fast enough
};

CCRotaryEncoder enc8 = { // Cue Jump DECK C
  {14, 15},       // pins
  107, // MIDI address (CC number + optional channel)
  1,            // optional multiplier if the control isn't fast enough
};



void setup() {
// Select the correct relative MIDI CC mode.
  // Options:
  //   - TWOS_COMPLEMENT (default)
  //   - BINARY_OFFSET
  //   - SIGN_MAGNITUDE
  //   - NEXT_ADDRESS
  // Aliases:
  //   - REAPER_RELATIVE_1
  //   - REAPER_RELATIVE_2
  //   - REAPER_RELATIVE_3
  //   - TRACKTION_RELATIVE
  //   - MACKIE_CONTROL_RELATIVE
  //   - KORG_KONTROL_INC_DEC_1
  RelativeCCSender::setMode(relativeCCmode::MACKIE_CONTROL_RELATIVE);
  Control_Surface.begin();  // Initialize the Control Surface
}
 
void loop() {
  Control_Surface.loop();  // Update the Control Surface
}

J'ai testé avec different relativeCCmode, rien y fait. Je suis totalement bloqué.

hello, le prg que tu postes n'est pas complet ???

Si complet.

Ce sont bien des potentiomètres linéaires, pas des logarithmiques?

Oui ce sont des Bourns PTV09A-4025F-B103. J'ai eu un doute un moment sur la livraison, mais finalement il y a bien marqué sous les potentiomètres "B103".
Puis j'ai oublié de dire mais j'ai testé avec l'Ohm mètre, et j'ai bien une évolution linéaire de la valeur de résistance. Donc ça ne vient pas du matériel mais bien d'ailleurs.

Bonjour ray-me

Aurais tu une résistance en série avec ton potentiomètre ?

Cordialement
jpbbricole

Ça y est erreur trouvée. J'utilise un Arduino due pour alimenter tout ça. J'ai tout mis sur le pin 5v, hors fallait mettre sur le pin 3,3v et tout rentre dans l'ordre. J'aurais pas cru que ça viendrait de là le problème.

dommage les PCB sont déjà imprimés. j'ai di enfoncer le pinheader du 5v de manière à ce qu'il ne s'emboite plus dans le contact de l'arduino. Un coup de fer à souder en appuyant sur le pin et ça rentre tout seul. j'ai fait un pont ensuite avec le 3,3v avec un bout de fil et le tour est joué.

Merci pour votre aide.

A+ pour de nouvelles aventures...

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.