So I am trying to have an LDR connected in a voltage divider setup to one of the pins of an Atmega32. I am trying to test a digital condition, presence or absence of light, so no ADC involved. However, after setting up my circuit on proteus, am not getting any positive results. The led still lights when I turn one of two switches on my circuit (which are meant to simulate a PIR SENSOR). I personally dont think it's a problem with the voltage divider but instead a problem with my connection of the micro controller. Please help out. As seen in the screenshot below, I have tried the voltage divider on 3 pins already (trial and error) with no success.
#define F_CPU 1000000UL
DDRB=0x00; //configuring PortB as input
DDRA=0x00; //configuring PortB as input
DDRD=0x00; //configuring PortD as input
DDRC=0xFF; // configuring PortC as output
PORTC=0x00; // initially off
GICR |= (1<<INT0)| (1<<INT0);
MCUCR |= (1<<ISC10) | (1<<ISC11);
if(!(PIND&(1<<0))) // In presence of darkness (When there is darkness pin goes low)
if((PINB&(1<<1))|(PINB&(1<<2))) // check for sensor pin PB.1 and PB.2 using bit. The 2 switches.
PORTC = 0x03; // buzzer /LED on
PORTC = 0x00;
PORTC=0x00; // buzzer/LED off