LED WITH MULTIPLEXER 74HC4067

LED 74HC4067

The code can be downloaded at :

https://github.com/triantara/ARDUINO-TRIANTARA/blob/main/74HC4067_LED.zip

#include <Mux.h>

Mux mux(2,3,4,5,6); // initialise on construct…
int counter=0;

void setup(){
Serial.begin(9600);
mux.setup(8,9,10,11,4); // initialise Mux (s0,s1,s2,s3,sig)
}

void loop(){
mux.write(0, HIGH); //Turn ON the selected LED
delay(100);
mux.write(0, LOW); //Turn OFF the selected LED
mux.write(1, HIGH); //Turn ON the selected LED
delay(100);
mux.write(1, LOW); //Turn OFF the selected LED
mux.write(2, HIGH); //Turn ON the selected LED
delay(100);
mux.write(2, LOW); //Turn OFF the selected LED
mux.write(3, HIGH); //Turn ON the selected LED
delay(100);
mux.write(3, LOW); //Turn OFF the selected LED
mux.write(4, HIGH); //Turn ON the selected LED
delay(100);
mux.write(4, LOW); //Turn OFF the selected LED
mux.write(5, HIGH); //Turn ON the selected LED
delay(100);
mux.write(5, LOW); //Turn OFF the selected LED
mux.write(6, HIGH); //Turn ON the selected LED
delay(100);
mux.write(6, LOW); //Turn OFF the selected LED
mux.write(7, HIGH); //Turn ON the selected LED
delay(100);
mux.write(7, LOW); //Turn OFF the selected LED
mux.write(8, HIGH); //Turn ON the selected LED
delay(100);
mux.write(8, LOW); //Turn OFF the selected LED
mux.write(9, HIGH); //Turn ON the selected LED
delay(100);
mux.write(9, LOW); //Turn OFF the selected LED
mux.write(10, HIGH); //Turn ON the selected LED
delay(100);
mux.write(10, LOW); //Turn OFF the selected LED
mux.write(11, HIGH); //Turn ON the selected LED
delay(100);
mux.write(11, LOW); //Turn OFF the selected LED
mux.write(12, HIGH); //Turn ON the selected LED
delay(100);
mux.write(12, LOW); //Turn OFF the selected LED
mux.write(13, HIGH); //Turn ON the selected LED
delay(100);
mux.write(13, LOW); //Turn OFF the selected LED
mux.write(14, HIGH); //Turn ON the selected LED
delay(100);
mux.write(14, LOW); //Turn OFF the selected LED
mux.write(15, HIGH); //Turn ON the selected LED
delay(100);
mux.write(15, LOW); //Turn OFF the selected LED

}

++++OTHER SKET++++++

#include <Mux.h>

Mux mux(2,3,4,5,4); // initialise on construct…
int counter=0;

void setup(){
Serial.begin(9600);
mux.setup(8,9,10,11,4); // initialise Mux (s0,s1,s2,s3,sig)
}

void loop(){
mux.write(counter, HIGH); //Turn ON the selected LED
delay(500);
mux.write(counter, LOW); //Turn OFF the selected LED

if(counter==15){
Serial.println(counter); //Print results
}
else{
Serial.print(counter);
Serial.print(“, “);
}

counter = ++counter & 15; //Add +1 to counter until 15
}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s