amateur_24
Member
testing if an push to make switch was pressed
Hi
I read the .
I connected a switch to my avr in exactly the same way but with my internal pull ups activated. In the tutorial it said that when the switch wasn't pressed it's a 1 and when it's pressed it's a 0.
if(PIND & 0b00000010)
{
//Switch is not pressed
...
}
Would that not be 0b0000000 for pressed? The idea is my code only runs when it's pressed. Or are you saying I must use an else
Hi
I read the .
I connected a switch to my avr in exactly the same way but with my internal pull ups activated. In the tutorial it said that when the switch wasn't pressed it's a 1 and when it's pressed it's a 0.
if(PIND & 0b00000010)
{
//Switch is not pressed
...
}
Would that not be 0b0000000 for pressed? The idea is my code only runs when it's pressed. Or are you saying I must use an else
Last edited: