MULTI ANALOG READ BY MUX74HC4067

Analog read by MUX74HC4067

The code can be downloaded at:

https://github.com/triantara/ARDUINO-TRIANTARA/blob/main/MUX74HC4067%20ANALOG%20READ.zip

#include “MUX74HC4067.h”

MUX74HC4067 mux(7, 8, 9, 10, 11);

void setup()

{

Serial.begin(9600);

while ( !Serial ) ;

mux.signalPin(A0, INPUT, ANALOG);

}

void loop()

{

int data;

for (byte i = 0; i < 16; ++i)

{

data = mux.read(i);

Serial.print((double)(data)/1023*5);

Serial.print(” “);

}

Serial.println();

//delay(500);

}

===OTHER SKET=======

#include “MUX74HC4067.h”

MUX74HC4067 mux(7, 8, 9, 10, 11);

void setup()

{

Serial.begin(9600);

while ( !Serial ) ;

mux.signalPin(A0, INPUT, ANALOG);

}

void loop()

{

{

int data0= mux.read(0);

int data1= mux.read(1);

int data2= mux.read(2);

int data3= mux.read(3);

int data4= mux.read(4);

int data5= mux.read(5);

int data6= mux.read(6);

int data7= mux.read(7);

int data8= mux.read(8);

int data9= mux.read(9);

int data10= mux.read(10);

int data11= mux.read(11);

int data12= mux.read(12);

int data13= mux.read(13);

int data14= mux.read(14);

int data15= mux.read(15);

Serial.print((double)(data0)/1023*5);

Serial.print(” “);

Serial.print((double)(data1)/1023*5);

Serial.print(” “);

Serial.print((double)(data2)/1023*5);

Serial.print(” “);

Serial.print((double)(data3)/1023*5);

Serial.print(” “);

Serial.print((double)(data4)/1023*5);

Serial.print(” “);

Serial.print((double)(data5)/1023*5);

Serial.print(” “);

Serial.print((double)(data6)/1023*5);

Serial.print(” “);

Serial.print((double)(data7)/1023*5);

Serial.print(” “);

Serial.print((double)(data8)/1023*5);

Serial.print(” “);

Serial.print((double)(data9)/1023*5);

Serial.print(” “);

Serial.print((double)(data10)/1023*5);

Serial.print(” “);

Serial.print((double)(data11)/1023*5);

Serial.print(” “);

Serial.print((double)(data12)/1023*5);

Serial.print(” “);

Serial.print((double)(data13)/1023*5);

Serial.print(” “);

Serial.print((double)(data14)/1023*5);

Serial.print(” “);

Serial.print((double)(data15)/1023*5);

Serial.print(” “);

}

Serial.println();

}

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