Pages: 1 2 [3]   Go Down
Author Topic: Mux Shield  (Read 4208 times)
0 Members and 1 Guest are viewing this topic.
Leiden, The Netherlands
Offline Offline
Newbie
*
Karma: 0
Posts: 30
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

So I wired up 16 potmeters to the first multiplexer and cut out the code for the second and third mux
Code:
//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
  Serial.begin(31250);
}

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
{
   Serial.write(message);
   Serial.write(control);
   Serial.write(value);
}
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).

Logged

Leiden, The Netherlands
Offline Offline
Newbie
*
Karma: 0
Posts: 30
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
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...
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 514
Posts: 31541
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
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.
Logged

Leiden, The Netherlands
Offline Offline
Newbie
*
Karma: 0
Posts: 30
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 smiley
so broken mux was probably the problem..
Logged

Global Moderator
Boston area, metrowest
Online Online
Brattain Member
*****
Karma: 443
Posts: 23834
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Did you lock the topic on purpose?
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Leiden, The Netherlands
Offline Offline
Newbie
*
Karma: 0
Posts: 30
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

nope. Unlocked it.
Logged

Pages: 1 2 [3]   Go Up
Jump to: