Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // #define __AVR_ATmega8__
- #define F_CPU 8000000UL /* 1 MHz CPU clock */
- #include <util/delay.h>
- #include <avr/io.h>
- int main() {
- DDRB = 0xFF; // LED output
- DDRD = 0x00; // Switch input
- PORTB = 2;
- for (;;) {
- // condition ? value if true : value if false
- //PORTB = PORTD ? 2 : 1;
- //PORTB = PIND ? 2 : 1;
- if (PIND & (0x01))
- PORTB = 0x01;
- else
- PORTB = 0x00;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement