artisticforge:
Which Ardunio Board are you using?
Which version Arduino IDE are you using?
Which operating system are you using?
Linux, MacOSX, MS Windows, other
What is the make and model of the LCD 20x4 display?
Do you have a diagram of the circuit?
If this is part of a tutorial do you have the link to the tutorial?
thanks you sir, i have the uno r3 and arduino ide newest downloaded today after fresh windows installation.
as for the lcd model idk it has the i2c daughterboard but i got it working with that code..
which i feel that its too long .. idk its working tho and about the tutorial and the library info.. im totally depending on the examples in the library idk if im allowed to link any tho.. but here it is
library: MUX74HC4067/examples/readAnalogSignals/readAnalogSignals.ino at master · nlamprian/MUX74HC4067 · GitHub
tutorial:
[tutorial] MUX74HC4067 | Codebender Blog
same wiring in the link for analog input, with potentiometers.
and the code...
#include "MUX74HC4067.h"
MUX74HC4067 mux(7, 8, 9, 10, 11);
#include <Wire.h>
#include <LCD.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x3F, 2, 1, 0, 4, 5, 6, 7);
void setup()
{
Serial.begin(9600);
lcd.begin(20, 4);
lcd.setBacklightPin(3, POSITIVE);
lcd.setBacklight(HIGH);
mux.signalPin(A0, INPUT, ANALOG);
}
void loop()
{
int a = 0; int b = 1; int c = 2;
{
int data[0];
for (byte i = 0; i < 1; ++i)
data[0] = mux.read(a);
Serial.print("Sen Ch ");
Serial.print(a);
Serial.print(" Is ");
Serial.print((double)(data[0]) * 100 / 1023);
Serial.println("%");
lcd.setCursor(0, 0);
lcd.print("Sen Ch ");
lcd.print(a);
lcd.setCursor(8, 0);
lcd.print(" Is ");
lcd.print((double)(data[0]) * 100 / 1023);
lcd.setCursor(19, 0);
lcd.print("%");
}
{
int data[1];
for (byte i = 1; i < 2; ++i)
data[1] = mux.read(b);
Serial.print("Sen Ch ");
Serial.print(b);
Serial.print(" Is ");
Serial.print((double)(data[1]) * 100 / 1023);
Serial.println("%");
lcd.setCursor(0, 1);
lcd.print("Sen Ch ");
lcd.print(b);
lcd.setCursor(8, 1);
lcd.print(" Is ");
lcd.print((double)(data[1]) * 100 / 1023);
lcd.setCursor(19, 1);
lcd.print("%");
}
{
int data[2];
for (byte i = 2; i < 3; ++i)
data[2] = mux.read(c);
Serial.print("Sen Ch ");
Serial.print(c);
Serial.print(" Is ");
Serial.print((double)(data[2]) * 100 / 1023);
Serial.println("%");
lcd.setCursor(0, 2);
lcd.print("Sen Ch ");
lcd.print(c);
lcd.setCursor(8, 2);
lcd.print(" Is ");
lcd.print((double)(data[2]) * 100 / 1023);
lcd.setCursor(19, 2);
lcd.print("%");
}
delay(50);
Serial.println();
delay(1500);
}