Button and Fader Midi

I have a midi controller with button and fader. I'm trying to solve the button and fader problem. The button follows fader value, when I press button, it have value 0 or 127 and it is not affected by the current position of the fader. Because my project just turn on or off rgb leds. For instance :
Red on : when I press button, it will be turn off red and turn on green. when I use fader, because fader value base on position, if i move from top to bottom 0->127 : red off green on, and turn back 127 -> 0 green off red on. The button only change status of led. I have a problem : both of red / green on or off together ? How can I solve ? Thanks !

This does not look like a software question, but like a philosophical one. You should to decide yourself.

@oscardory sorry but your question makes very little sense. You know what you have, we don't.

Please post the code you are using, a schematic of your hardware, hand drawn is fine Fritzing is not. And a photograph or two of your boards.

Please say what in MIDI these buttons and pots are controlling, and try again to say what your code does and what you want it to do.

No, midi controller decide. I try to get simulation leds from it !

In what way does your reply #2 match what I asked for?

And the rest?

Why not

void OnTally()
{  
  for(int i = 0;  i< 4; i++) {   
      if (TallyA[i] == 0) {digitalWrite(PGMA[i], LOW);} else {digitalWrite(PGMA[i], HIGH);}
      if (TallyB[i] == 0 || TallyA[i] == 1) {digitalWrite(PSTB[i], LOW);} else {digitalWrite(PSTB[i], HIGH);
   }
}

It is becoming clearer now but not quite there. Why are there no resistors with the LEDs?
Can you post a link to that commercial unit you have please?

1 Like

I want the leds to be brighter so that no resistors. And commercial unit for what ?

So thanks ! your code is better and clearly ! It work ! That's only one part I called choose position, the rest is swap positions when use fader and button down near fader

No you can't do that because you will draw too much current from the Arduino pins and damage them in the long term. What is the current rating of these LEDs from the data sheet?
If this exceeds about 30mA then you must use a transistor to drive them and include an appropriate size resistor. This acts a bit like a constant current driver.

Yes, I know that. because I use LEDs 10mm instead of 3mm or 5mm. It has higher resistance. Don't worry too much about it, because I've been using them for a long time.

LEDs do NOT have a resistance.

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