Go Down

Topic: Mux Shield and LCD (Read 742 times) previous topic - next topic

darksheep

Hi

I followed this http://www.sparkfun.com/tutorials/251 and It made sense to me , but now I need more ports for other thing.
I bought this /0/]http://mayhewlabs.com/products/arduino-mux-shield#!prettyPhoto[gallery]/0/ , but I have no idea how to change the code to make it work, could you guys offer some  help.

Thank you for you time and patience with a noob.

johnwasser

Move the LCD data lines to 6,7,8,and 9 because the MUX Shield uses 2,3,4,and 5 for addressing.  Then change the LiquidCrystal calls to specify the new location of the data lines.
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

darksheep

Ok thanks will do,but I am still not sure how to address the individual pins on the mux in my code.

For example how would you get this code to work when using the mux

Code: [Select]


// constants won't change. They're used here to
// set pin numbers:
const int buttonPin1 = 2;     // the number of the pushbutton pin


// variables will change:
int buttonState = 0;         // variable for reading the pushbutton status

void setup() {
  Serial.begin(9600);       
  // initialize the pushbutton pin as an input:
  pinMode(buttonPin1, INPUT);

}

void loop(){
  if (digitalRead(buttonPin1) == LOW) {
    digitalWrite(ledPin, LOW); // turn LED OFF
  } else if (digitalRead(buttonPin2) == LOW) {
    digitalWrite(ledPin, HIGH); // turn LED ON
  }
}

johnwasser

Doesn't the MUX Shield maker supply any instructions, sample code, libraries or anything?!?

Code: [Select]

int digitalReadMux(int muxPin)
    {
    digitalWrite(2, muxPin & 1);
    digitalWrite(3, muxPin & 2);
    digitalWrite(4, muxPin & 4);
    digitalWrite(5, muxPin & 8);
    rerturn digitalRead(A0+(muxPin/16));
    };

int analogReadMux(int muxPin)
    {
    digitalWrite(2, muxPin & 1);
    digitalWrite(3, muxPin & 2);
    digitalWrite(4, muxPin & 4);
    digitalWrite(5, muxPin & 8);
    rerturn analogRead(A0+(muxPin/16));
    };
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

darksheep

They some have example code at the bottom of their page but I don't understand it lol

http://mayhewlabs.com/products/arduino-mux-shield

johnwasser

Perhaps you need to examine the schematic diagram of the shield and study the datasheet of the mux chip to see what is connected to where and how the chip works.
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Go Up