Debian Codegraph @

examples/copy-bit-2.c

raw symbols SCIP
1
2 #include <avr/io.h> // Include file for I/O operations
3
4
5 int main (void)
6 {
7 DDRA = 0; // Port A as Input
8 PORTA = 1; // Enable pullup on PORTA, bit 0
9 DDRB = 1; // Pin 0 of Port B as output
10
11 for(;;)
12 if(PINA & 1) // If PA0 is set
13 PORTB |= 1; // Set PB0, by ORing with 00000001b
14 else // otherwise clear PB0
15 PORTB &= ~1; // by ANDing with 11111110b (~00000001b)
16
17
18 }