Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define F_CPU 8000000UL
- #include <avr/io.h>
- #include <util/delay.h>
- #define VIIVE1 200
- #define VIIVE2 100
- void jokaToinenLedVilkutus()
- {
- unsigned char luku01=0xAA, luku02=0x55;
- PORTB=~luku01;
- _delay_ms(VIIVE1);
- PORTB=~luku02;
- _delay_ms(VIIVE2);
- }
- int main(void)
- {
- //unsigned int i=0
- DDRB = 0XFF;
- PORTB = 0XFF;
- DDRD = 0X40;
- PORTD = 0X7C;
- while(1)
- {
- if(!( PIND & (1<<PORTD2))) //Lue PIND2 eli switch 1
- {
- jokaToinenLedVilkutus();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement