I was doing a project and I noticed the program going unexpectedly wrong. I was doubtful about the button inputs so I made a simple program to check this capability of the MCU.
Ignore 0x11, it still means that Pin B0 should be set high (even though it was a typo).
Now the MCU is being supplied a voltage of 5 volt DC. When the Pin A0 is grounded, the voltage on pin B0 is 3.21V and when its disconnected from ground, Pin B0 is at a voltage of 1.63 V
What's going wrong?
I am making a binary clock and without the buttons, the clock was working fine. Now I had to add the time set buttons and problems started to appear....
Have you applied external Pull Up Resistors at the Switch Ports?
When not, do that, or activate the internal Pullups by writing a locic 1 to the according PORT Bits
PORTA=0b00000011;
DDRA=0b00000000;
activates the internal Pullups at Port A Bit 0 and 1.