Working with two analog sensors at the same time, ATmega16

Hello guys! I want to work with two analog sensors connected to ATmega16. The first one is the temperature sensor (LM35), connected to PA0. The LED should be ON when the temperature goes high. The second one is the photoresistor and it’s connected to PA1. I want to turn the LED ON when the lighting is low.

I was looking for a solution all over the internet, but couldn’t find something similar to my situation. They all just say one thing- you can’t read two analog sensors at the same time.

I have this code that works just for one sensor:

#define F_CPU 1600000UL
#include <avr/io.h>
#include <util/delay.h>


void ADC_Init()
{
	DDRA=0x0;			
	ADCSRA = 0x87;			
	ADMUX = 0x40;			
	
}

uint16_t ADC_Read(uint8_t channel)
{
	ADMUX= (ADMUX & 0xF0) | (channel & 0x0F);

	ADCSRA |= (1 << ADSC);
	while (ADCSRA & (1 << ADSC));

	return ADC;
}

int main(void)
{
    ADC_Init();
    DDRB=0xFF;

    while (1) 
    {
	    uint8_t value;
		
	    value=ADC_Read(0);
		
		if (value < 70)
		{
		    PORTB|=(1<<0);
		}
		else
		{
		  PORTB &=~(1<<0);
	  }	
    }	
}

Can you somehow help me to modify this code, give me advice on how can I do it, or some example?

I believe it would look something like the following. Please note that I just used the code you had posted and made some assumptions (I did not look at the actual registers to see if they were correctly mapped - just assumed the code you have did that). You can’t read two inputs at the same exact time; but you can read them in sequence and it will provably be close enough (i.e. within msec, if not tens/hundreds of usec).

int main(void)
{
	ADC_Init();
	DDRB=0xFF;

	while (1) 
	{
		uint8_t value;

		// read temp
		value=ADC_Read(0); // read CH0
		
		// set LED (at PB0) HIGH if value is greater than 70, set LOW otherwise
		if (value > 70)
		{
			PORTB|=(1<<0);
		}
		else
		{
			PORTB &=~(1<<0);
		}	


		// read photoresistor
		value=ADC_Read(1); // read CH1
		
		// set LED (at PB0) HIGH if value is less than 70, set LOW otherwise
		if (value < 70)
		{
			PORTB|=(1<<0);
		}
		else
		{
			PORTB &=~(1<<0);
		}	
	}	
}