목록Univ (103)
ITGenerations
//source 5// Dotmatrix 함수#include #include unsigned char pattern[3]={0xFE,0xFD,0xFB};void main(){int i=0;DDRA=0xFF;while(1){msec_delay(500);//속도 조절 if(++i==3) i=0;PORTA = pattern[i];} } void msec_delay(int n){for(; n>0; n--){_delay_ms(1);//속도 조절 }}
//source4//led 배열 그리고 인덱스 함수 활용//delay 라이브러리 선언/*#include #include void msec_delay(int n);unsigned char pattern[3]={0xFE, 0xFD, 0xFB};int main(){int i=0;DDRA=0xFF;while(1){msec_delay(500);if(++i==3)i=0;PORTA=pattern[i];}} void msec_delay(int n){for(; n>0; n--)_delay_ms(5);} */
LED 3개를 배열을 이용해서 순차적으로 실행. //source3//led 배열을이용하여 LED순차적으로 켠다/*#include void msec_delay(int n);unsigned char pattern[5]={0xFE, 0xFD, 0xFB, 0xF7,0xF5}; int main(){int i=0;DDRA=0xFF;while(1){msec_delay(500);if(++i==5)i=0;PORTA=pattern[i];}} void msec_delay(int n){ int i; for(;n>0; n--) {for(i=0; i
led 3개 순차적으로 저항없이 실행 //source 2//led 3개 순차적으로 실행/*#include void msec_delay(int n);int main(){DDRA=0xFF;while(1){msec_delay(500);PORTA=0x01; msec_delay(500);PORTA=0x02; msec_delay(500);PORTA=0x04;}} void msec_delay(int n){ int i; for(; n>0;n--) {for(i=0; i