Multiple LM35 sensor display

Good day.

My goal is to make a complete temperature monitor using 5x LM35 sensors and display each sensor’s data on 16x2 lcd in a time interval of 3 seconds each.

My code here is to get one sensor to work. Please help to edit code to read multiple sensors and display each sensor data for a time period of 3 seconds.

Here is my code:

#include <LiquidCrystal. h>

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

Int CPUPin = 0;

void setup() {

lcd.begin(16,2);

}

vood loop() {

int value = analogRead(CPUPin) ;

lcd.setCursor(0,1);

float milivolts = (value / 1024.0) * 5000;

float celsius = milivolts / 10;

lcd.clear();

lcd.print(“CPU”);

lcd.setCursor(0,1);

lcd.print(celsius);

lcd.print(" 'C") ;

lcd.setCursor(0,1);

delay(2000);

}

Please use code tags to post code so the forum software doesn’t mangle it. It’s the </> icon on the far left of the dialog box when posting.

This compiles, I have no idea if it actually works…

#include <LiquidCrystal.h>

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
int CPUPin[5] = { 0, 1, 2, 3, 4};

void setup()   {
  lcd.begin(16, 2);
}

void loop()  {

  for (int i = 0; i <= 5; i++) {
    int value = analogRead(CPUPin[i]) ;
    lcd.setCursor(0, 1);
    float milivolts = (value / 1024.0) * 5000;
    float celsius  = milivolts / 10;
    lcd.clear();
    lcd.print("CPU");
    lcd.setCursor(0, 1);
    lcd.print(celsius);
    lcd.print("   'C") ;
    lcd.setCursor(0, 1);
    delay(2000);
  }
}
lcd.clear();

lcd.print("CPU");

lcd.setCursor(0,1);  (1)

lcd.print(celsius);

lcd.print("   'C") ;

lcd.setCursor(0,1);

At (1) - resetting the cursor to 0,1 will start writing at the "P" of CPU. Set it eg to (0,5)
2/ Write " " spaces between readings to make them readable.

Allan

Thank you to everyone who gave me advice my code is working great now. please check my new post How to blink led in my code. I need some help there

thanks