Room temperature with LM35 using Arduino Uno Atmega328p and MicroC pro

General discussion on mikroC PRO for AVR.
Post Reply
Author
Message
thisisblazing
Posts: 1
Joined: 26 Apr 2022 18:34

Room temperature with LM35 using Arduino Uno Atmega328p and MicroC pro

#1 Post by thisisblazing » 26 Apr 2022 18:49

Hello !
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);
}
Please help me out :roll:

User avatar
filip
mikroElektronika team
Posts: 11874
Joined: 25 Jan 2008 09:56

Re: Room temperature with LM35 using Arduino Uno Atmega328p and MicroC pro

#2 Post by filip » 02 Jun 2022 11:38

Hi,

Have you tried the LM32 example from the Examples folder in the compiler's installation folder ?
\mikroC PRO for AVR\Examples\Development systems\EasyAVR7\LM35\

Regards,
Filip.

Post Reply

Return to “mikroC PRO for AVR General”