Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <avr/io.h>
- #include <avr/interrupt.h>
- uint8_t i = 0;
- uint8_t links = 0;
- ISR(TIMER0_OVF_vect)
- {
- if(!i) {
- links = 1;
- } else if ( i == 8 ) {
- links = 0;
- }
- if (links) {
- PORTB = ~(1 << i++);
- }
- else {
- PORTB = ~(1 << --i);
- }
- }
- int main(void)
- {
- DDRB=0xFF;
- PORTB=0xFF;
- TCCR0=0x05;
- TIMSK=0x01;
- sei();
- while(1);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement