tttapa / MIDI_controller

This is a library for creating a MIDI controller using an Arduino or Teensy board.
GNU General Public License v3.0
403 stars 70 forks source link

(Solved) Input with VCC not GND, how to do it? #35

Closed brian12112 closed 6 years ago

brian12112 commented 6 years ago

There is any solution for triggering the pin with vcc (Debounce) and not with gnd? Thank you Mr. tttapa

tttapa commented 6 years ago

Normally, you don't need this, usually, buttons are wired between ground and an input.

If you really need it, you can use Digital::invert().

brian12112 commented 6 years ago

Can you give a example where to put it ?

I try Digital::invert button(2, C4, 1, velocity); But I cant compile it. Thanks

tttapa commented 6 years ago

No, Digital::invert() just means that invert is a method of the Digital class.

Digital button(2, C4, 1, velocity);

void setup() {
  button.invert();
}
brian12112 commented 6 years ago

Thank you Mr. tttapa. And what a quick response. I will try it.

brian12112 commented 6 years ago

Awesome!. It works Great. Thanks again Mr. tttapa.

Just last questions. Can I do the same for Multiplexer? Digital buttons[] = { {multiplexer.pin(0), 0x10, 1, velocity}, {multiplexer.pin(1), 0x11, 1, velocity}, {multiplexer.pin(2), 0x12, 1, velocity}, {multiplexer.pin(3), 0x13, 1, velocity}, {multiplexer.pin(4), 0x14, 1, velocity}, {multiplexer.pin(5), 0x15, 1, velocity}, {multiplexer.pin(6), 0x16, 1, velocity}, {multiplexer.pin(7), 0x17, 1, velocity}, or I must use another IC? like shift register or else?

tttapa commented 6 years ago

Yes. But you might have to change the pin mode (to disable the internal pull-up resistor). ExtIO::pinMode(multiplexer.pin(0)); (You only have to do it for one pin, it will change it for the entire multiplexer.)

brian12112 commented 6 years ago

Yes, Mr. tttapa. Its working great! Thank you for your Awesome Library.