Go Down

Topic: Mux Shield (Read 11777 times) previous topic - next topic


So I wired up 16 potmeters to the first multiplexer and cut out the code for the second and third mux
Code: [Select]
//Give convenient names to the control pins
#define CONTROL0 5    //S3
#define CONTROL1 4    //S2
#define CONTROL2 3    //S1
#define CONTROL3 2    //S0

//create temporary variables for analog input
int tempmux0;

//create char look up tables for MIDI CC
char control0[] = { 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16 };

//create variables which hold the pinnumbers the three muxs send their data to
int COM1 = 0;

//Create arrays for data from the the MUXs
int mux0array[16];

void setup()
  //Set MUX control pins to output
  pinMode(CONTROL0, OUTPUT);
  pinMode(CONTROL1, OUTPUT);
  pinMode(CONTROL2, OUTPUT);
  pinMode(CONTROL3, OUTPUT);
//Default speed of MIDI serial port

void loop()

  for (int i=0; i<16; i++)
    //The following 4 commands set the correct logic for the control pins to select the desired input
    digitalWrite(CONTROL0, (i&15)>>3);
    digitalWrite(CONTROL1, (i&7)>>2); 
    digitalWrite(CONTROL2, (i&3)>>1); 
    digitalWrite(CONTROL3, (i&1));     
    tempmux0 = analogRead(0)/8;  //divide by 8 to get in the range of 1-127
    tempmux0 = analogRead(0)/8;  //divide by 8 to get in the range of 1-127
    if( abs(mux0array[i] - tempmux0) > 2) {
     mux0array[i] = tempmux0;
        MidiTX(char(0xB0), control0[i], char(mux0array[i]) );   //control[i] is a char look up table for the controller number to change

void MidiTX(byte message, byte control, byte value) //pass values out through standard Midi Command

and nothing showed in the midi monitor. Then I tried it again with 16 potmeters and the whole code for 3 MUXs and got the old problem again. However, not all pots seemed to be working. Some showed nothing in the midi monitor upon twisting and some did. With one potmeter, I tried to find out why. It turned out that the pins 8,9,15,0,1 returned values to the midimonitor and the other pins didn't send anything (or maybe the computer didn't receive it - I don't know).


and nothing showed in the midi monitor.

Wrong formulation, I meant that the same problem still occurred. About the pins, I tested it today and now only pin 0 and 1 showed signs of life. I'm beginning to wonder whether my mux shield is broken...


I'm beginning to wonder whether my mux shield is broken...

That has crossed my mind especially with placements at a jaunty angle to get things working.


Ordered a new multiplexer, went on vacation. When I came back, the new mux was waiting for me. I wired it up and it worked :)
so broken mux was probably the problem..


Did you lock the topic on purpose?
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.


nope. Unlocked it.

Go Up