Code: Select all
while (1) {
if (Button(&PORTB, 4, 1, 1)) { // detect logical one on RB1 pin
oldstate4 = 1; }
if (oldstate4 && Button(&PORTB, 4, 1, 0)) { // detect one-to-zero transition on RB1 pin
PORTC = ~PORTC;
oldstate4 = 0; }
if (Button(&PORTB, 5, 1, 1)) { // detect logical one on RB1 pin
oldstate5 = 1; }
if (oldstate5 && Button(&PORTB, 5, 1, 0)) { // detect one-to-zero transition on RB1 pin
PORTC = ~PORTC;
oldstate5 = 0; }
} // endless loop