bauche
Junior Member level 1
Hi there
a liitle prob in c
i have 2 input port A0 and port A1 i want to put on 1 led if both of them pressed (closed) together...i found out a solution but if 1 input is close
led not working ...but if my two input is close led goes on ...and when my two input is open led goes on too....
a liitle prob in c
i have 2 input port A0 and port A1 i want to put on 1 led if both of them pressed (closed) together...i found out a solution but if 1 input is close
led not working ...but if my two input is close led goes on ...and when my two input is open led goes on too....
Code:
void main() {
ADCON1 |= 0x0F;
TRISA = 0xff;
TRISB = 0;
for(;;)
{
if((RA0_bit=1)==(RA1_bit=1)) //if button is pressed
{
RB4_bit=1;
}
else
{
RB4_bit=0;
}
}
}