라즈베리파이 GPIO 활용강좌 : 아두이노(멀티두이노) LED 켜기
아두이노(멀티두이노) LED 켜기
Created Date: 2013.11.09
Modified Date: 2013.11.09
revision 1
안녕하세요 마을이장 나무꾼 입니다.
이미 저희는 “ ATMEGA328 Cheap으로 멀티두이노 만들기 ” 강좌를 통해 멀티파이를 이용한 멀티두이노를 이용한 아두이노 기본강좌를 진행 해 보려 합니다.
[사진1] 멀티두이노
오늘은 그 첫번째로 Atmega328 Cheap 의 기본 핀 구조(GPIO 포트)와 MCU 사용에 기초가 되는 LED 켜기 예제를 통해 알아보는 시간을 가져 보도록 하자.
0. MutiDuino Pin Number Descripion
그럼 가장먼저 [그림1]을 통해 Atmega328에 해당하는 아래 핀별 설명도를 참고 해 보도록 하자.
[그림1] Atmega328 datasheet
1. MutiDuino 와 LED 결선도
[그림 2] Atmega328 과 LED 결선도
2. MutiDuino IDE 실행하기
라즈베리파이를 부팅 후에 아래 명령어를 입력 하여 X11(리눅스 윈도우) 을 실행하자.
pi@openmake ~ $ startx
[그림3] X11(GUI) Arduino IDE 실행화면
[그림3]에서와 같이 바탕화면에 LXTerminal 을 실행하고, 아래 명령어를 입력하여, Arduino IDE를 실행 해 보자.
pi@openmake ~ $ sudo arduino
Arduino 기본 샘플 소스 중 Blink를 선택하고, 아래와 같이 Pin Number 7 번으로 소스를 변경 후에 소스를 멀티두이노에 업로드(기존 강좌 중 1-8.1 참고) 해보자.
아두이노 Example Blink Source
/* Blink Turns on an LED on for one second, then off for one second, repeatedly. This example code is in the public domain. */ // Pin 7 has an LED connected on most Arduino boards. // give it a name: int led = 7; // the setup routine runs once when you press reset: void setup() { // initialize the digital pin as an output. pinMode(led, OUTPUT); } // the loop routine runs over and over again forever: void loop() { digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level) delay(1000); // wait for a second digitalWrite(led, LOW); // turn the LED off by making the voltage LOW delay(1000); // wait for a second } |
다음 시간에는 멀티두이노에 LED를 연결하고 라즈베리파이 GPIO 를 이용해 제어할 수 있는 방법에 대해 포스트 하도록 하겠습니다.