I am a biomedical engineer student and ı have a project to do. My project is going to be Smart Home and its include multiple variables like room temperature (lm35), bulb brightness (ldr), gas sensor and more. I tried to do with potentiometer (because sensors is expensive in my country) in microc but ı couldnt do it. Based on my researches and my knowledge ı have to do this with ADC. I write a code analog to digital convertor but ı cant specify my purposes.( When potentiometer or sensor pass certain level LED light up , else LED mustnt ligh up). Here is my Analog to Digital convertor code ;
Code: Select all
void ADC_ISR () org IVT_ADDR_ADC
{
PORTD=ADCH;
ADCSRA |= (1<< ADSC);
}
void main()
{
DDRD=0xFF;
SREG_I_bit=1;
ADMUX=0x60;
ADCSRA=0X8E;
ADSC_bit=1;
while(1);
}