Pages: [1]   Go Down
Author Topic: Mux Shield and LCD  (Read 688 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 15
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 212
Posts: 8975
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Offline Offline
Newbie
*
Karma: 0
Posts: 15
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:

// 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
  }
}
Logged

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 212
Posts: 8975
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Code:
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));
    };
Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Offline Offline
Newbie
*
Karma: 0
Posts: 15
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 212
Posts: 8975
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Pages: [1]   Go Up
Jump to: