Skip to content

Commit 18a7757

Browse files
committed
Led port
1 parent f983016 commit 18a7757

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

_01_IO_Exercise/_01_IO_Exercise.ino

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/********************************************************************************
2+
Product : LKino-MEGA128
3+
Project : LED, BUZZER 출력 테스트
4+
Date : 2017-01-19
5+
Author : Kyung Nam Lee
6+
Company : LKEMBEDDED ( http://www.lkembedded.co.kr )
7+
Comments: LED와 부저가 주기적으로 ON/OFF를 반복하는 프로그램
8+
9+
Pin map
10+
AVR Arduino Device
11+
PE0 D0 LED0
12+
PE1 D1 LED1
13+
PE2 D2 LED2
14+
PE3 D3 LED3
15+
PE4 D4 LED4
16+
PE5 D5 LED5
17+
PE6 D6 LED6
18+
PE7 D7 LED7
19+
PD4 D22 BUZZ
20+
********************************************************************************/
21+
#define F_CPU 16000000UL
22+
#include <avr/io.h>
23+
#include <util/delay.h>
24+
void setup() // 초기화
25+
{
26+
// 모든 포트를 출력으로 설정 및 초기화
27+
DDRA = 0XFF; PORTA = 0X00;
28+
DDRB = 0XFF; PORTB = 0X00;
29+
DDRC = 0XFF; PORTC = 0X00;
30+
DDRD = 0XFF; PORTD = 0X00;
31+
DDRE = 0XFF; PORTE = 0X00;
32+
DDRF = 0XFF; PORTF = 0X00;
33+
DDRG = 0XFF; PORTG = 0X00;
34+
}
35+
void loop() // 무한루프
36+
{
37+
// 모든 포트가 0.5초 간격으로 ON/OFF
38+
PORTA = 0XFF;
39+
PORTB = 0XFF;
40+
PORTC = 0XFF;
41+
PORTD = 0XFF;
42+
PORTE = 0XFF;
43+
PORTF = 0XFF;
44+
PORTG = 0XFF;
45+
delay(500);
46+
PORTA = 0X00;
47+
PORTB = 0X00;
48+
PORTC = 0X00;
49+
PORTD = 0X00;
50+
PORTE = 0X00;
51+
PORTF = 0X00;
52+
PORTG = 0X00;
53+
delay(500);
54+
}

0 commit comments

Comments
 (0)