Build an Arduino code to control multiple CD74HC4067 Multiplexers

Job ID: 37070099

Budget: $10 – $30 CAD

I need a code to control minimum of 4 CD74HC4067 modules. It would be awesome if the code is written in the way that would allow to expand to more MUX modules. Mux modules connected to Arduino Mega R3. Currently there are 4 modules hooked up. They are split into pairs and outputs of each pair are paralleled. Two pairs make up one large 32 pin connector with Pair#1 having their output feeding the bottom portion of 32 pin connector and Pair #2 to the upper portion.

In each pair MUXs are configured as receiver and transmitter. Transmitters connected to PWM pin and Receivers to Analog In pin.

So I need a function written so that I can just turn ON channels like this.

mux.enable(Pin, Pin); Which should enable any of the pins from 0 to 31)
mux.disable(); Would turn off all MUX modules
mux.* maybe some other useful features that you could think of.




https://www.sparkfun.com/datasheets/IC/CD74HC4067.pdf


1 Module Transmitter (Pair #1)
SIG = D13
S3 = D37
S2 = D38
S1 = D39
S0 = D40
EN = D41

2 Module Receiver (Pair #1)
SIG = A0
S3 = D32
S2 = D33
S1 = D34
S0 = D35
EN = D36

3 Module Transmitter (Pair #2)
SIG = D12
S3 = D27
S2 = D28
S1 = D29
S0 = D30
EN = D31

4 Module Receiver (Pair #2)
SIG = A1
S3 = D22
S2 = D23
S1 = D24
S0 = D25
EN = D26