「main.c」 #include <avr/io.h> #define F_CPU 1200000U #include <util/delay.h> #include "74HC595.h"
unsigned char display = 0x00;
int main(void) { DDRB = PORTB = 0xff; while (1) { HC595_SerIn(~display); HC595_ParOut(); if (display % 2 == 0) PORTB |= _BV(4); else PORTB &= ~_BV(4); _delay_ms(500); display++; } return 0; }
|