Multiplexing Help - Digital I/O Pins

Hi,

I am new to Arduino, so I have some simple questions about using an Arduino Mega 2560 to communicate to some multiplexers (MUX36S16). My goal is to use 4 of the digital I/O pins to send signals to each multiplexer to select an input on the multiplexer. I am looking for some help on setting pins HIGH and LOW and to configure the I/O pins to be set as outputs. If anyone could direct me to someone else's post or some sample code, that would be amazing. Thank you in advance for your help.

-Spencer

wsbz001:
I am new to Arduino,

Looks to me you don't even started yet... Did you even open standard examples like the most basic one like Blink? What questions can you possible have about "setting pins HIGH and LOW and to configure the I/O pins to be set as outputs" after looking at that... ::slight_smile:

#define PIN10 10

void setup() {

pinMode(PIN10 , OUTPUT); // set PIN10 as output
}

void loop() {
digitalWrite(PIN10 , HIGH); // turn PIN 10 on
delay(1000); // wait for a second
digitalWrite(PIN10 , LOW); // turnPIN 10 off
delay(1000); // wait for a second
}

So you copied your version of Blink... But what about it?

PS

#define PIN10 10

Most terrible name of today defined in the most terrible way...

septillion:
So you copied your version of Blink... But what about it?

PS

#define PIN10 10

Most terrible name of today defined in the most terrible way...

I hope this version is better for you, but certainly worse for wsbz001.

void setup() 
{
  pinMode(SS, OUTPUT); // set Pin 10 as output
}


void loop() 
{
  digitalWrite(SS, HIGH);   // turn Pin 10 on
  delay(1000);                       // wait for a second
  digitalWrite(SS, LOW);    // turn Pin 10 off 
  delay(1000);                       // wait for a second
}

@Reiter what on Earth has an LED blink program got to do with the original question?

A good way of setting the multiplex select pins to a number is shown in he first part of this. Arrays

But it is a bit advanced for a beginner.

Look at the following diagram and then use pinMode() function to set the directions of the digital IO lines as indicated. There is no need to initialize the direction of analog line A0; it will be automatically working as input when this instruction is executed: analogRead(A0);.
mux.png

mux.png