#include <LiquidCrystal.h>
const int muxSIG=A0;
const int muxS0=4;
const int muxS1=3;
const int muxS2=2;
const int muxS3=11;
float temp;// Variable to store temp values, initial temp variable being 0.
float temp1;
float temp2;
LiquidCrystal lcd(5,6,7,8,9,10);// digital pins in arduino board connected to LCD
int SetMuxChannel( byte channel){
digitalWrite(muxS0,bitRead(channel,0));
digitalWrite(muxS1,bitRead(channel,1));
digitalWrite(muxS2,bitRead(channel,2));
digitalWrite(muxS3,bitRead(channel,3));
}
void setup() {
Serial.begin(9600);
lcd.begin(16,2);
lcd.print("Cyborg_Task...");
lcd.setCursor(0,1);//setting the (column,row) value
lcd.print("1.4_task2");
delay(2000);// after a delay of 2sec clear the screen
lcd.clear();
pinMode(muxS0, OUTPUT);
pinMode(muxS1, OUTPUT);
pinMode(muxS2, OUTPUT);
pinMode(muxS3, OUTPUT);
pinMode(muxSIG, INPUT);
// put your setup code here, to run once:
}
void loop() {
//signal in C0 is set to be shown for 2s.
SetMuxChannel(0);
//for temperature
float temp = 1 / (log(1 / (1023. /analogRead(muxSIG) - 1)) / 3950 + 1.0 / 298.15) - 273.15;
lcd.setCursor(0, 1);
lcd.print ("Puri's_Temp:");
lcd.print(temp);
lcd.print("C");
Serial.print ("Puri's_Temp:");
Serial.print(temp);
Serial.print("C\n");
delay (2000);//Delay of 2 second for ease of viewing in serial monitor
//signal in C1 is set to be shown for 2s.
SetMuxChannel(1);
//for temperature
float temp1 = 1 / (log(1 / (1023. / analogRead(muxSIG)- 1)) / 3950 + 1.0 / 298.15) - 273.15;
lcd.setCursor(0, 1);
lcd.print ("Rourkela's_Temp:");
lcd.print(temp1);
lcd.print("C");
Serial.print ("Rourkela's_Temp:");
Serial.print(temp1);
Serial.print("C\n");
delay (2000);//Delay of 2 second for ease of viewing in serial monitor
//signal in C2 is set to be shown for 2s.
SetMuxChannel(2);
//for temperature
float temp2 = 1 / (log(1 / (1023. / analogRead(muxSIG) - 1)) / 3950 + 1.0 / 298.15) - 273.15;
lcd.setCursor(0, 1);
lcd.print ("Kakatpur's_Temp:");
lcd.print(temp2);
lcd.print("C");
Serial.print ("Kakatpur's_Temp:");
Serial.print(temp2);
Serial.print("C\n");
delay (2000);//Delay of 2 second for ease of viewing in serial monitor
}
Loading
cd74hc4067
cd74hc4067