Closed BBABO closed 6 years ago
The first argument of the Analog
constructor is a pin number, not a value.
The library supports multiplexers right out of the box, you can use:
AnalogMultiplex multiplexer(A0, { 47, 46, 45, 44 } ); // 74HC4067
Analog potentiometers[] = {
{multiplexer.pin(0), 0x1, 1},
{multiplexer.pin(1), 0x2, 1},
{multiplexer.pin(2), 0x3, 1},
{multiplexer.pin(3), 0x4, 1},
{multiplexer.pin(4), 0x5, 1},
{multiplexer.pin(5), 0x6, 1},
{multiplexer.pin(6), 0x7, 1},
{multiplexer.pin(7), 0x8, 1},
{multiplexer.pin(8), 0x9, 1},
{multiplexer.pin(9), 0xA, 1},
{multiplexer.pin(10), 0xB, 1},
{multiplexer.pin(11), 0xC, 1},
{multiplexer.pin(12), 0xD, 1},
{multiplexer.pin(13), 0xE, 1},
{multiplexer.pin(14), 0xF, 1},
{multiplexer.pin(15), 0x10, 1}
};
You don't need #include <MUX74HC4067.h>
at all.
Thank's a lot for the rapid answer ! So cool that the multiplexer is already included in the library ! 🥇 I tought it was only for 8 channel multiplexer ! Thank again ! Can i make a donation for support ?
Hi, First of all thank a lot for your awesome workc ! I've started midi controller building with a teensy 3.2 thank's to MIDIUSB library then i wanted to go for an Arduino Mega 16u2 in order to have more I/O.
I'd rapidly realised that's arduino Mega wasn't natively able to comunicate Midi over usb but thank's to your work and your extremely well explained guide i managed to flash the arduino mega and do some basic stuff with your MIDI controller Library.
The problem occurred when i tried to use 74HC4067 16 channel multipkexer with the Midi controller library. I used this library to Read the multiplexer : Everything is okay with reading the multiplexer , ( i've had a problem with the multiplexer reading false value, to solve this i've had to connect unused multiplexer pin to ground ) but when i try this the potentiometer work fine but it's sending on all CC 1 to 15. So despite the potentiometer is intend to send is value on CC 1 it is sending on all CC 1 to 15 .
I dont know where is the error, i'm new into arduino so i hope i didn't make a beginer fault. Thank's again for your work 👍 Full support From France !
Here is the complete code :