tag:blogger.com,1999:blog-21441607008717861332024-03-06T11:22:27.816+09:00ARDUnity Project유니티(Unity)와 아두이노(Arduino)를 이용한 메이커 솔루션인 아두니티(Ardunity) 활용에 관한 내용을 다룹니다.Anonymoushttp://www.blogger.com/profile/10315630713623521810noreply@blogger.comBlogger63125tag:blogger.com,1999:blog-2144160700871786133.post-34959158404055433352017-06-21T10:20:00.003+09:002017-06-21T10:28:11.531+09:00Unite '17 Seoul 아두니티 강연Unite 행사는 Unity에서 매년마다 개최하는 최대 규모의 컨퍼런스입니다.<br />
미국 본사에서 먼저 진행한 후 각국마다 순차적으로 개최되는데, Unity Korea에서 2017년 5월 15일부터 17일까지 서울 코엑스에서 개최된 것이 바로 Unite '17 Seoul입니다.<br />
<br />
저는 1기 유니티 마스터(명예홍보대사)로써 이 행사에서 "아두이노와 유니티 연동으로 VR게임 만들기"란 주제로 한 세션을 맡아 강연을 했습니다.<br />
이때 발표를 유니티 코리아에서 촬영한 후 편집하여 유투브에 공유해주셨기에 이를 포스트합니다.<br />
<br />
본 강연을 보신다면 ARDUnity가 어떻게 개발되었고, 어떤 가치를 지향하고 있는지 등을 조금은 이해하실 수 있으리라 생각합니다.<br />
ARDUnity는 기술상으로 아두이노란 범용 임베디드 개발 솔루션과 게임 개발 솔루션인 유니티를 연동한 것이지만, 실질적인 목표는 하드웨어와 소프트웨어를 융합하여 보다 새로운 경험과 가치를 줄 수 있는 제품 개발 솔루션이 되고자 하는 것입니다.<br />
이 거대한 목표를 위해 보잘것 없지만, 나름 하드웨어와 소프트웨어 모두 경험이 많은 제가 이 일을 시작했고 ARDUnity란 이름으로 결과를 만들었습니다.<br />
저는 이 아이디어를 끊임없이 발전시켜서 궁극적으로는 새로운 방식의 개발 방법론으로 정착시키고자 노력할 것입니다.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<iframe width="320" height="266" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/Boej5Zg0Cho/0.jpg" src="https://www.youtube.com/embed/Boej5Zg0Cho?feature=player_embedded" frameborder="0" allowfullscreen></iframe></div>
<br />
<br />Anonymoushttp://www.blogger.com/profile/10315630713623521810noreply@blogger.com1tag:blogger.com,1999:blog-2144160700871786133.post-25892170525702264602016-10-06T14:46:00.000+09:002017-05-27T14:52:51.029+09:00아두니티에서 사용 가능한 하드웨어<b>ArdunityApp</b> (Arduino Board)<br />
거의 모든 시리즈의 아두이노 보드를 사용할 수 있습니다. (호환 보드 포함)<br />
본 블로그의 모든 글은 Arduino Uno를 기준으로 쓰여졌습니다.<br />
아두니티에서는 Arduino Board 복수 개 동시 제어가 가능합니다.<br />
<ul>
<li>Arduino Uno</li>
<li>Arduino Nano</li>
<li>Arduino Mega</li>
<li>Arduino Reonardo</li>
<li>Arduino Zero (ADC, PWM Resolution 선택 가능)</li>
<li>Arduino Due (ADC, PWM Resolution 선택 가능)</li>
<li>Arduino 101</li>
<li>Arduino Yun</li>
<li>Intel Edison</li>
</ul>
<br />
<b><br /></b>
<b>DigitalOutput</b><br />
아두이노 보드의 Digital Pin을 OUTPUT 모드로 하여 제어가 가능한 모든 하드웨어<br />
<ul>
<li><a href="http://ardunityproject.blogspot.kr/2016/07/digitaloutput.html" target="_blank">LED (On/Off 제어)</a></li>
<li><a href="http://ardunityproject.blogspot.kr/2016/07/color-led.html" target="_blank">Color LED (8 색상 제어)</a></li>
<li>DC Motor (단방향 On/Off 제어)</li>
</ul>
<div>
<br /></div>
<div>
<br /></div>
<div>
<b>DigitalInput</b></div>
<div>
아두이노 보드의 Digital Pin을 INPUT(or INPUT_PULLUP) 모드로 하여 제어가 가능한 모든 하드웨어</div>
<div>
<ul>
<li><a href="http://ardunityproject.blogspot.kr/2016/07/digitalinput_27.html" target="_blank">Push Button</a></li>
</ul>
<div>
<br /></div>
</div>
<div>
<br /></div>
<div>
<b>AnalogOutput</b></div>
<div>
아두이노 보드의 PWM Pin으로 제어가 가능한 모든 하드웨어</div>
<div>
<ul>
<li><a href="http://ardunityproject.blogspot.kr/2016/07/analogoutput_31.html" target="_blank">LED (밝기 제어)</a></li>
<li><a href="http://ardunityproject.blogspot.kr/2016/07/color-led.html" target="_blank">Color LED (이론상 65535 색상 제어)</a></li>
<li>DC Motor (단방향 속도 제어)</li>
</ul>
</div>
<br />
<br />
<b>AnalogInput</b><br />
아두이노 보드의 ADC Pin으로 제어가 가능한 모든 하드웨어<br />
<ul>
<li><a href="http://ardunityproject.blogspot.kr/2016/08/blog-post.html" target="_blank">Potentiometer (가변 저항)</a></li>
<li><a href="http://ardunityproject.blogspot.kr/2016/08/blog-post_42.html" target="_blank">Photocell (빛 센서)</a></li>
<li><a href="http://ardunityproject.blogspot.kr/2016/08/soft-potentiometer.html" target="_blank">Soft Potentiometer</a></li>
<li><a href="http://ardunityproject.blogspot.kr/2016/08/blog-post_68.html" target="_blank">TMP36 (온도 센서)</a></li>
<li><a href="http://ardunityproject.blogspot.kr/2016/08/blog-post_25.html" target="_blank">Flex Sensor (온도 센서)</a></li>
<li>FSR (압력 센서)</li>
<li>Piezo Sensor (진동 센서)</li>
<li>GP2Y0A21YK (적외선 거리 센서)</li>
</ul>
<br />
<br />
<b>PulseOutput</b><br />
아두이노 보드의 Digital Pin으로 정확한 주기의 Pulse를 내보내야 하는 하드웨어<br />
<ul>
<li>카메라 플래시 제어</li>
</ul>
<br />
<br />
<b>GenericServo</b><br />
아두이노 Servo라이브러리로 제어 가능한 표준 PWM제어 방식을 사용하는 모든 서보 모터<br />
<ul>
<li><a href="http://ardunityproject.blogspot.kr/2016/09/rc.html" target="_blank">RC Servo</a></li>
</ul>
<div>
<br /></div>
<div>
<br /></div>
<div>
<b>GenericTone</b></div>
<div>
아두이노 Tone라이브러리로 제어 가능한 Buzzer</div>
<div>
RTTTL을 이용한 멜로디 연주가 가능합니다.</div>
<div>
<ul>
<li><a href="http://ardunityproject.blogspot.kr/2016/10/buzzer.html" target="_blank">Piezo Buzzer</a></li>
</ul>
<div>
<br /></div>
</div>
<div>
<br /></div>
<div>
<b>GenericMotor</b> (<span style="color: #e06666;">ARDUnity Deluxe Only</span>)</div>
<div>
H-bridge 회로 기반으로 제어되는 모든 DC 모터 드라이버</div>
<div>
DC 모터의 양 방향, 속도 제어가 가능합니다.</div>
<div>
<ul>
<li><a href="http://ardunityproject.blogspot.kr/2016/10/dc.html" target="_blank">Arduino Motor Shield (호환 보드 포함)</a></li>
<li><a href="http://ardunityproject.blogspot.kr/2016/10/dc.html" target="_blank">L298</a></li>
<li><a href="http://ardunityproject.blogspot.kr/2016/10/dc.html" target="_blank">L293</a></li>
</ul>
<div>
<b><br /></b>
<b><br /></b></div>
</div>
<div>
<b>GenericStepper</b> (<span style="color: #e06666;">ARDUnity Deluxe Only</span>)</div>
<div>
스테핑 모터 제어</div>
<div>
WAVE(1상 여자), FULL STEP(2상 여자), HALF STEP(1-2상 여자)방식 제어 지원</div>
<div>
속도 제어 모드, 각도 제어 모드 선택 가능</div>
<div>
<ul>
<li>ULN2003A and 28BYJ-48</li>
</ul>
</div>
<div>
<br /></div>
<br />
<b>MPUSeries</b> (<span style="color: #e06666;">ARDUnity Deluxe Only</span>)<br />
<a href="https://www.invensense.com/" target="_blank">Invensense</a>사에서 만든 IMU 센서 보드 제어<br />
동시 2개 센서 제어를 지원합니다. (3개 이상 동시 제어는 아직 미 지원)<br />
<ul>
<li><a href="http://ardunityproject.blogspot.kr/2016/08/mpu-60509250.html" target="_blank">MPU-6050/6500/9150/9250</a></li>
</ul>
<div>
<br /></div>
<div>
<br /></div>
<div>
<b>CommSerial</b></div>
<div>
Windows/Mac에서 시리얼 포트를 사용하여 아두이노 보드와 통신할 수 있습니다.</div>
<div>
Bluetooth SPP의 경우 Windows/Mac에서 시리얼 포트로 잡히기 때문에 사용 가능합니다.</div>
<div>
<ul>
<li><a href="http://ardunityproject.blogspot.kr/2016/06/ardunity_97.html" target="_blank">USB2Serial</a></li>
</ul>
<div>
<br /></div>
</div>
<div>
<br /></div>
<div>
<b>CommBluetooth</b> (<span style="color: #e06666;">ARDUnity Deluxe Only</span>)</div>
<div>
Android에서 Bluetooth SPP를 사용하여 아두이노 보드와 통신할 수 있습니다.</div>
<div>
<ul>
<li><a href="http://ardunityproject.blogspot.kr/2016/10/commbluetooth.html" target="_blank">아두니티 안드로이드 빌드</a></li>
<li><a href="http://ardunityproject.blogspot.kr/2016/10/hc-06.html" target="_blank">아두이노 HC-06 연결</a></li>
</ul>
</div>
<div>
<br />
<div>
<b>HM-10</b> (<span style="color: #e06666;">ARDUnity Deluxe Only</span>)</div>
<div>
Android/iOS에서 HM-10 모듈을 이용해서 사용하여 아두이노 보드와 Bluetooth LE 통신을 할 수 있습니다.<br />
<br />
<br /></div>
</div>
<div>
<b>CommWifi</b> (<span style="color: #e06666;">ARDUnity Deluxe Only</span>)</div>
<div>
모든 플랫폼에서 아두이노 보드와 TCP 연결을 할 수 있습니다.</div>
<div>
아두이노 보드가 TCP Server, 유니티가 TCP Client가 됩니다.</div>
<div>
<ul>
<li><a href="http://ardunityproject.blogspot.kr/2016/10/commwifi.html" target="_blank">Arduino Yun</a></li>
<li><a href="http://ardunityproject.blogspot.kr/2016/10/commwifi.html" target="_blank">DFRobot WiFi Shield</a></li>
<li>ESP8266 (향후 지원 예정)</li>
</ul>
<div>
<br /></div>
</div>
<div>
<br /></div>
<div>
<b>DeviceRollReactor</b> (<span style="color: #e06666;">ARDUnity Deluxe Only</span>)</div>
<div>
스마트 폰의 지면에 대한 기울기를 알려줍니다.</div>
<div>
RC카의 조종 인터페이스로 활용 가능합니다.</div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<b>DeviceRotationReactor</b> (<span style="color: #e06666;">ARDUnity Deluxe Only</span>)</div>
<div>
스마트 폰의 후면 카메라 방향에 대한 기울기를 알려줍니다.</div>
<div>
AR관련 어플리케이션 개발에 활용 가능합니다.</div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<b>DeviceCamera</b> (<span style="color: #e06666;">ARDUnity Deluxe Only</span>)</div>
<div>
PC 및 스마트 폰의 카메라 영상을 사용할 수 있습니다.</div>
<div>
스마트 폰의 경우 전/후면 카메라 선택이 가능합니다.</div>
<div>
<br /></div>
<div>
<br /></div>
Anonymoushttp://www.blogger.com/profile/10315630713623521810noreply@blogger.com6tag:blogger.com,1999:blog-2144160700871786133.post-2581276663201853532016-10-03T15:35:00.001+09:002016-10-03T15:36:53.388+09:00CommWifiCommWifi를 사용하면 아두이노 보드와 인터넷 통신을 할 수 있습니다.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgg3HMMDbMkcnqhW7UB_ghIKsvmgpRPp3QqBEfjwfxqFwS27wQz5NM5rKLEkXv_P7d_vcd2T_vAc6lnlXDNqT8cLoQtXkVKPgCo24VBN_EOFhNnrYutGmxRu3CRvt7lPyq-sYJ2HFzkyGY/s1600/CommWifi+Menu.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="111" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgg3HMMDbMkcnqhW7UB_ghIKsvmgpRPp3QqBEfjwfxqFwS27wQz5NM5rKLEkXv_P7d_vcd2T_vAc6lnlXDNqT8cLoQtXkVKPgCo24VBN_EOFhNnrYutGmxRu3CRvt7lPyq-sYJ2HFzkyGY/s400/CommWifi+Menu.png" width="400" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj5HdMb3eqmruv0EliykuCwRQ1UCjm3B7-hL4tYMmNnnKjzLpKzOGvMZ_mSIOskv4WbEBMxMW8mwwCs66RdmPCqpNtRqxof443mPVI_YjVid09uT63f6mN6F8C5sw9qZLWVUqSQDRhpssI/s1600/CommWifi+Block.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="123" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj5HdMb3eqmruv0EliykuCwRQ1UCjm3B7-hL4tYMmNnnKjzLpKzOGvMZ_mSIOskv4WbEBMxMW8mwwCs66RdmPCqpNtRqxof443mPVI_YjVid09uT63f6mN6F8C5sw9qZLWVUqSQDRhpssI/s200/CommWifi+Block.png" width="200" /></a></div>
<br />
인터넷 통신이란 말은 너무 폭넓은 의미이기에 조금 구체화할 필요가 있습니다.<br />
인터넷은 전 세계적으로 모든 컴퓨터가 연결된 개념을 의미합니다.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhXNJTtuTNoykbzfq0jL6NDQavaSKCGSe6Di49TMQtCNRA3XYuesjFYjhNxkP__q_7ONobKnzk7z8knOeTUQ_iKUA_fWNGXXZShU58h9X25_TxgJ4P-BfuIFBiyAAiGqskhcJw5mZ2KsYM/s1600/Internet.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="204" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhXNJTtuTNoykbzfq0jL6NDQavaSKCGSe6Di49TMQtCNRA3XYuesjFYjhNxkP__q_7ONobKnzk7z8knOeTUQ_iKUA_fWNGXXZShU58h9X25_TxgJ4P-BfuIFBiyAAiGqskhcJw5mZ2KsYM/s320/Internet.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">인터넷은 모든 컴퓨터가 연결됨을 의미한다.</td></tr>
</tbody></table>
<br />
이런 통신이 가능하려면 모든 컴퓨터는 자신을 구별하기 위해 고유한 식별자를 가져야 하는데, 이것을 IP 어드레스라고 부릅니다. 이 IP 주소 체계에 따라 IPv4, IPv6등으로 전문적인 용어가 사용됩니다.<br />
또한, 컴퓨터에서 실행되는 프로그램을 구별해야 하기 때문에 포트(Port)라 부르는 통신 채널 번호가 존재합니다.<br />
다시 정리하면 인터넷 통신을 하기 위해서는 다음 2가지가 있어야 한다는 의미입니다.<br />
<ul>
<li>IP Address</li>
<li>Port</li>
</ul>
<div>
인터넷을 하기 위한 식별 정보는 아무나 할 수 없고 반드시 정식 서비스로 등록되어야만 전 세계 컴퓨터와 연결될 수 있습니다. 이것을 도메인(Domain)이라 부르고, 도메인 서비스 업체를 통해 일정한 비용을 지불하고 얻게됩니다.</div>
<div>
이 도메인은 사람이 이해하기 쉽도록 www.mydomain.com 등의 형식으로 사용되지만, 내부적으로는 IP Address와 Port를 사용해서 통신하는 것입니다.</div>
<div>
<br /></div>
<div>
인터넷 통신을 이해하기 위한 중요한 개념은 프로토콜(Protocol)입니다. 앞에서 언급한 IP와 Port는 식별 정보이고 실제로 컴퓨터간에 데이터를 어떤 방법으로 주고받을 것인지를 정하는 것이 프로토콜입니다.</div>
<div>
현재 인터넷상에서 규격화되어 널리 사용되는 프로토콜은 대략 다음과 같습니다.</div>
<div>
<ul>
<li>TCP</li>
<li>UDP</li>
<li>HTTP</li>
<li>FTP</li>
</ul>
<div>
위에서 언급한 프로토콜 외에도 더 많은 종류가 있으며 새로운 프로토콜이 개발되고 있습니다.</div>
</div>
<div>
따라서, 여러분이 만든 장치(아두이노)를 인터넷에 연결하려면 다음에 대해 생각해야 합니다.</div>
<div>
<ul>
<li>어떻게 고유한 IP와 Port를 얻을 것인가?</li>
<li>무슨 프로토콜을 사용할 것인가?</li>
</ul>
<div>
이와 같이 인터넷 통신은 생각해야 할 문제가 많은 복잡한 작업입니다.</div>
</div>
<div>
<br /></div>
<div>
하지만, 다행히 집에서 혼자 테스트하는 정도라면 간단하게 해볼 수 있는 방법이 많이 나와있습니다.</div>
<div>
우선, 집집마다 사용하는 유/무선 공유기는 자신에게 연결된 장치들의 IP 주소를 관리해줍니다. DHCP라고 부르는 기능은 유/무선 공유기가 자동으로 IP를 할당하여 관리하는 편리한 기능입니다.</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://www.cirrich.com/userfiles/200915174458.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://www.cirrich.com/userfiles/200915174458.JPG" height="143" width="200" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">유/무선 공유기는 IP를 관리해준다.</td></tr>
</tbody></table>
<div>
<br /></div>
<div>
따라서, 여러분은 직접 IP를 정하거나 유/무선 공유기가 DHCP 기능으로 인해 자동 할당된 IP를 알아냄으로써 쉽게 IP를 정할 수 있습니다.</div>
<div>
포트 번호는 다른 프로그램과 겹치지 않도록 고유 번호를 사용하면 됩니다.</div>
<div>
<br /></div>
<div>
다음으로 할 일은 프로토콜 선택입니다.</div>
<div>
CommWifi는 TCP만 지원하기에 아두이노와 통신하기 위해서는 반드시 TCP 프로토콜이 가능해야 합니다.</div>
<div>
TCP 프로토콜은 Server와 Client로 역할이 나뉩니다.</div>
<div>
<ul>
<li>TCP Server: TCP Client 연결을 기다리며 접속 요청을 처리합니다.</li>
<li>TCP Client: TCP Server에 접속 요청을 하여 연결합니다.</li>
</ul>
<div>
아두이노는 TCP Server가 되어야 하고, 유니티는 TCP Client가 되어야 합니다.</div>
</div>
<div>
이와 같은 이유로 CommWifi에서 Inspector 설정 정보는 다음과 같습니다.</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEghUh-lELexcBcYIP1OWPV44-APpBWdCk-c8vsq6wdCW0AgZa8ZSFrzZVwTCljy3tIIgPl4HjZc13ftDR9UAyjcV_HVtyZrXjFwhgalsKaIx33fV80_5XyQx97wB46Qqetsgjlpod29Zuw/s1600/CommWifi+Inspector.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEghUh-lELexcBcYIP1OWPV44-APpBWdCk-c8vsq6wdCW0AgZa8ZSFrzZVwTCljy3tIIgPl4HjZc13ftDR9UAyjcV_HVtyZrXjFwhgalsKaIx33fV80_5XyQx97wB46Qqetsgjlpod29Zuw/s320/CommWifi+Inspector.png" width="216" /></a></div>
<div>
<ul>
<li>IP Address: TCP Server의 IP 주소</li>
<li>Port: TCP Server와 통신할 포트 번호</li>
<li>OnOpen: TCP Server와 통신 연결되었을 때</li>
<li>OnClose: TCP Server와 통신 연결이 해제되었을 때</li>
<li>OnOpenFailed: TCP Server와 통신 연결 시도가 실패했을 때</li>
<li>OnErrorClosed: TCP Server와 통신 연결이 강제로 해제되었을 때</li>
</ul>
<div>
CommWifi는 ArdunityApp에 연결되어 아두이노 보드의 하드웨어를 제어할 수 있습니다.</div>
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgsqJQEqXF6OVL_N-m6ExFNceZRlvt3H1-c4VUfoNu4pCFX01OS3MOq9tb536NM1EId9UNvcv3Qgxf6HgIbDQpS08Spc2b6OXpHzXm8USlWiMhoXdwIvDjinr7ziWZj1rJfLv75fD-Yg_I/s1600/CommWifi+Wiring.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="115" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgsqJQEqXF6OVL_N-m6ExFNceZRlvt3H1-c4VUfoNu4pCFX01OS3MOq9tb536NM1EId9UNvcv3Qgxf6HgIbDQpS08Spc2b6OXpHzXm8USlWiMhoXdwIvDjinr7ziWZj1rJfLv75fD-Yg_I/s320/CommWifi+Wiring.png" width="320" /></a></div>
<div>
<br /></div>
<div>
WiFi 통신은 PC나 스마트 기기에서 모두 가능하기에 CommWifi는 Windows/Mac/Android/iOS에서 모두 가능합니다.</div>
<div>
다만, 앞에서 언급했듯이 아두이노 보드가 도메인이 없는 관계로 유/무선 공유기를 통해서만 통신 테스트를 해야합니다.</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://res.cloudinary.com/hugoaoilw/image/upload/tilywqffx8r1jq98u16c" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="222" src="https://res.cloudinary.com/hugoaoilw/image/upload/tilywqffx8r1jq98u16c" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">반드시 유/무선 공유기에 연결하여 테스트해야 한다.</td></tr>
</tbody></table>
<div>
<br /></div>
<div>
이제 인터넷 통신을 위한 아두이노 장치에 대해 알아보겠습니다.</div>
<div>
아두이노를 위한 수 많은 인터넷 통신이 가능한 모듈들이 있지만, CommWifi를 사용하려면 반드시 TCP Server가 가능한 부품을 사용해야 합니다.</div>
<div>
아두니티 예제에서 테스트된 부품은 다음의 2종류입니다.</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://www.arduino.cc/en/uploads/Main/A000008_featured.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="240" src="https://www.arduino.cc/en/uploads/Main/A000008_featured.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">아두이노 윤(Yun) 보드</td></tr>
</tbody></table>
<div>
<br /></div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://www.dfrobot.com/wiki/images/thumb/1/1b/TEL0047_WIFI_SHIELD_v2_2_PHOTO.jpg/350px-TEL0047_WIFI_SHIELD_v2_2_PHOTO.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="237" src="https://www.dfrobot.com/wiki/images/thumb/1/1b/TEL0047_WIFI_SHIELD_v2_2_PHOTO.jpg/350px-TEL0047_WIFI_SHIELD_v2_2_PHOTO.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">DFRobot사의 Wifi Shield</td></tr>
</tbody></table>
<div>
<br /></div>
<div>
안타깝지만, 아두이노에서 많이 언급되는 ESP8266은 CommWifi와 통신할 수 없습니다. 향후, ESP8266도 가능하도록 업데이트할 예정입니다.</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://statics3.seeedstudio.com/images/product/WiFi%20Serial%20Transceiver%20Module.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="240" src="https://statics3.seeedstudio.com/images/product/WiFi%20Serial%20Transceiver%20Module.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">ESP8266은 아직 지원하지 않습니다.</td></tr>
</tbody></table>
<div>
<br /></div>
<div>
아두이노 Yun과 DFRobot의 Wifi Shield는 모두 TCP Server로 작동시킬 수 있습니다.</div>
<div>
다만, 아두이노 Yun과 DFRobot의 Wifi Shield는 아두이노 스케치가 다르기때문에 이에 맞는 설정이 필요합니다.</div>
<div>
아두이노 Yun은 인터넷 통신을 위한 칩과 아두이노 Uno 보드가 합쳐져있습니다. 아두이노 Yun에서는 인터넷 통신을 위해 UART를 사용할 수 없고, Bridge라고 부르는 라이브러리를 사용하여 SPI통신을 해야 합니다.</div>
<div>
즉, 아두이노 Yun과 CommWifi가 통신하려면 ArdunityApp에서 Stream Class를 Bridge로 선택해야 합니다.</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgfEFLUvyM9t0qMJojtclA3O1jSM1d-x2rrmuREC791l4NrCnxzqnFlm_cWA8Sz_98LK7vMKCSXBd-f2nKoh3l19yBbxzn2JmEmrm89T1k8duO3t-4YmwpLnuO9CzJjgK9rIG-KcekTZlw/s1600/ArdunityApp+Bridge.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="180" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgfEFLUvyM9t0qMJojtclA3O1jSM1d-x2rrmuREC791l4NrCnxzqnFlm_cWA8Sz_98LK7vMKCSXBd-f2nKoh3l19yBbxzn2JmEmrm89T1k8duO3t-4YmwpLnuO9CzJjgK9rIG-KcekTZlw/s200/ArdunityApp+Bridge.png" width="200" /></a></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
DFRobot의 Wifi Shield는 아두이노 보드와 인터넷 통신 칩이 UART로 연결되어 있습니다. 따라서, 아두이노 스케치에서 기존과 동일하게 Serial Stream Class로 통신할 수 있습니다.</div>
<div>
<br /></div>
<div>
아두이노 Yun과 DFRobot의 Wifi Shield를 유/무선 공유기에 연결하거나 IP와 Port를 알아내는 방법은 각자의 매뉴얼을 참고하시기 바랍니다.</div>
<div>
<ul>
<li><a href="https://www.arduino.cc/en/Guide/ArduinoYun#toc2" target="_blank">Arduino Yun 설정 방법</a></li>
<li><a href="https://www.dfrobot.com/wiki/index.php?title=WIFI_Shield_V3_PCB_Antenna_SKU:TEL0078" target="_blank">DFRobot의 Wifi Shield 설정 방법</a></li>
</ul>
</div>
<div>
<br /></div>
<div>
<br /></div>
Anonymoushttp://www.blogger.com/profile/10315630713623521810noreply@blogger.com3tag:blogger.com,1999:blog-2144160700871786133.post-50791216832815418782016-10-03T14:04:00.004+09:002016-10-03T14:05:19.615+09:00아두이노에서 HC-06 다루기HC-06은 Bluetooth SPP 통신을 위한 장치입니다.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://makezine.com/wp-content/uploads/2012/12/T11ETWOOA4peEdBY.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://makezine.com/wp-content/uploads/2012/12/T11ETWOOA4peEdBY.jpg" height="150" width="200" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">HC-06</td></tr>
</tbody></table>
<br />
HC-06의 Pin은 다음과 같이 구성되어 있습니다.<br />
<ul>
<li>VCC: 전원(+) 핀</li>
<li>GND: 접지(-) 핀</li>
<li>TX: 데이터 송신 핀</li>
<li>RX: 데이터 수신 핀</li>
</ul>
<div>
주의할 점은 HC-06은 2가지 타입이 있는데, 데이터 송수신 핀의 전압에 따라 3.3V와 5V 타입으로 나뉩니다. 자신이 갖고 있는 HC-06 모듈이 어떤 타입인지 잘 알고 있어야 합니다.</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://img.fasttechcdn.com/112/1129202/1129202-1.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="173" src="https://img.fasttechcdn.com/112/1129202/1129202-1.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">HC-06 3.3V 타입</td></tr>
</tbody></table>
<div>
<br /></div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://iotmodules.co.uk/media/catalog/product/cache/1/image/1600x/040ec09b1e35df139433887a97daa66f/h/c/hc06-bluetooth-3_2.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="200" src="https://iotmodules.co.uk/media/catalog/product/cache/1/image/1600x/040ec09b1e35df139433887a97daa66f/h/c/hc06-bluetooth-3_2.jpg" width="200" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">HC-06 5V 타입</td></tr>
</tbody></table>
<div>
<br /></div>
<div>
아두이노 Uno는 5V로 부품을 제어 하기때문에 HC-06 5V 타입은 그대로 연결해도 되지만, HC-06 3.3v 타입은 전압을 맞춰줘야만 사용할 수 있습니다.</div>
<div>
3.3v 전압을 맞추기 위해서 사용하는 회로는 전압 분배(Voltage Divider) 회로입니다.</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgU53x-GDrnqRlVnKXJPryApln4xdddLJnfZbgOM79opcgGv7rNOQuhIAOVoleSRhsZ6AWcRVJuMYLzYEmgEXbDzvPc_3VS7lPOmU6JKCwPJ276FWV9ToDWUBGxH0ZU0-Cl-ZASolraAz8/s1600/voltage+divider.gif" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="246" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgU53x-GDrnqRlVnKXJPryApln4xdddLJnfZbgOM79opcgGv7rNOQuhIAOVoleSRhsZ6AWcRVJuMYLzYEmgEXbDzvPc_3VS7lPOmU6JKCwPJ276FWV9ToDWUBGxH0ZU0-Cl-ZASolraAz8/s1600/voltage+divider.gif" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">전압 분배 회로</td></tr>
</tbody></table>
<div>
<br /></div>
<div>
R1과 R2의 크기를 1:2 비율로 맞춘다면 공식에 의해 5 * (2/3) = 3.33의 계산이 이루어집니다. 따라서, HC-06 3.3v 타입은 전압 분배 회로와 같이 사용해야 합니다.</div>
<div>
<br /></div>
<div>
아두이노 보드는 외부 장치와 통신할 수 있는 UART를 1개만 보유하고 있습니다. 이것은 USB에 연결되어 있어서 PC와 통신할때 사용합니다.</div>
<div>
만약, HC-06을 UART에 연결하면 USB통신을 할 수 없습니다.</div>
<div>
따라서, HC-06을 연결하여 USB 통신을 포기하던가 아니면 HC-06과의 연결을 선택할 수 있도록 만들어서 USB와 HC-06을 번갈아 사용해야 합니다.</div>
<div>
<br /></div>
<div>
아두이노에는 UART가 부족할 때, UART 기능을 만들 수 있는 유용한 라이브러리가 있습니다.</div>
<div>
이것의 이름은 SoftwareSerial이며 이것을 사용하면 UART를 추가할 수 있습니다.</div>
<div>
많은 아두이노 HC-06 예제를 보면 SoftwareSerial을 이용해서 통신을 하는 것을 볼 수 있습니다.</div>
<div>
실제 UART를 이용한 통신 소스와 SoftwareSerial을 이용한 통신 소스를 비교해보면 그 사용법이 유사한 것을 알 수 있습니다.</div>
<div>
<br /></div>
<div>
<실제 UART 통신 소스></div>
<div>
<span style="color: blue;">void</span> setup()</div>
<div>
{</div>
<div>
Serial.begin(9600);</div>
<div>
}</div>
<div>
<br /></div>
<div>
<span style="color: blue;">void</span> loop()</div>
<div>
{</div>
<div>
<span style="color: blue;">if</span>(Serial.available() > 0)</div>
<div>
{</div>
<div>
<span style="color: blue;">char</span> data = Serial.read();</div>
<div>
Serial.write(data);</div>
<div>
}</div>
<div>
}</div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<SoftwareSerial 통신 소스></div>
<div>
<span style="color: blue;">#include</span><SoftwareSerial.h></div>
<div>
<br /></div>
<div>
SoftwareSerial softSerial(10, 11);</div>
<div>
<br /></div>
<div>
<span style="color: blue;">void</span> setup()</div>
<div>
{</div>
<div>
softSerial.begin(9600);</div>
<div>
}</div>
<div>
<br /></div>
<div>
<span style="color: blue;">void</span> loop()</div>
<div>
{</div>
<div>
<span style="color: blue;">if</span>(softSerial.available() > 0)</div>
<div>
{</div>
<div>
char data = softSerial.read();</div>
<div>
softSerial.write(data);</div>
<div>
}</div>
<div>
}</div>
<div>
<br /></div>
<div>
차이점은 Serial과 달리 SoftwareSerial은 TX, RX에 대한 핀 번호가 필요하다는 것입니다. 그 이유는 UART를 사용하는 Serial은 TX, RX 핀 번호가 고정되어 있지만, SoftwareSerial은 아무 핀이나 사용할 수 있기때문에 여러분이 정해줘야 한다는 것입니다.</div>
<div>
이 이유로 SoftwareSerial을 통한 HC-06의 아두이노 연결 회로는 다음과 같습니다.</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg4xc9k5_cYa1w5oqpXbkelddaX89pjoeGWIIuxnoBGQdeeRIP2keavEDVhmVlZk-80j7fRsCgIx2QECmZKLaybTfSNzseuzpjIRmdl2kOxZqEbtVV57aIcIiGsupY1wm9rhjIiP7v4fGg/s1600/HC-06+%25283v%25291.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg4xc9k5_cYa1w5oqpXbkelddaX89pjoeGWIIuxnoBGQdeeRIP2keavEDVhmVlZk-80j7fRsCgIx2QECmZKLaybTfSNzseuzpjIRmdl2kOxZqEbtVV57aIcIiGsupY1wm9rhjIiP7v4fGg/s320/HC-06+%25283v%25291.jpg" width="316" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">HC-06 3.3v 타입 연결</td></tr>
</tbody></table>
<div>
<br /></div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgSUnx5tzjUKP1k96GjYqg9Oz6sffdKF8xQ4CfzbtBJ4Mv-7sVkKoKnouZqaI4UiAjhBC8Wr5RDyq-zQe7UWhi1nNiVdotnyQK0Lq1VF28obZvLyZR6631JPwxvRXnCbJ5bqThvRriLlhM/s1600/HC06+%25285v%2529.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="140" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgSUnx5tzjUKP1k96GjYqg9Oz6sffdKF8xQ4CfzbtBJ4Mv-7sVkKoKnouZqaI4UiAjhBC8Wr5RDyq-zQe7UWhi1nNiVdotnyQK0Lq1VF28obZvLyZR6631JPwxvRXnCbJ5bqThvRriLlhM/s400/HC06+%25285v%2529.png" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">HC-06 5v 타입 연결</td></tr>
</tbody></table>
<div>
<br /></div>
<div>
아두이노 보드와 HC-06이 시리얼 통신을 하기 위해서 가장 중요한 것은 통신 속도를 맞추는 것입니다. 시리얼 통신에서 통신 속도는 보레이트(Baudrate)라고 부르며, 아무 숫자나 사용하는 것이 아니고 규격이 정해져있습니다.</div>
<div>
<ul>
<li>4800bps</li>
<li>9600bps</li>
<li>19200bps</li>
<li>38400bps</li>
<li>57600bps</li>
<li>115200bps</li>
</ul>
</div>
<div>
이 중에 골라서 사용해야 하는데, 값이 클수록 고속 통신이기에 주고받을 수 있는 데이터 양이 많아집니다. 문제는 아두이노 보드에서 보레이트는 스케치 작성을 통해 설정할 수 있지만, HC-06은 그렇지 못하다는 것입니다.</div>
<div>
HC-06의 보레이트를 변경하기 위해서는 다른 방법을 사용해야 합니다.</div>
<div>
HC-06은 통신에 필요한 설정을 위해 AT Command라는 방식을 사용합니다.</div>
<div>
이것은 HC-06의 TX, RX선을 사용해서 AT+데이터라는 특별한 형식으로 정보를 보내주면 필요한 설정을 할 수 있는 방식입니다.</div>
<div>
AT Command 사용 방법은 인터넷을 통해 쉽게 찾을 수 있는데, 여기서는 자주 사용하는 몇 가지만 소개하겠습니다.</div>
<table align="center" border="1" cellpadding="5" cellspacing="1" style="text-align: center;"><tbody>
<tr><td>AT Commnad</td><td>Response</td><td>Function</td></tr>
<tr><td>AT</td><td>OK</td><td>HC-06이 연결되었는지 확인</td></tr>
<tr><td>AT+NAMEOOO</td><td>OKsetname</td><td>블루투스 장치 검색 시 나타나는 이름 설정</td></tr>
<tr><td>AT+BAUD4</td><td>OK9600</td><td>보레이트를 9600bps로 설정</td></tr>
<tr><td>AT+BAUD5</td><td>OK19200</td><td>보레이트를 19200bps로 설정</td></tr>
<tr><td>AT+BAUD6</td><td>OK38400</td><td>보레이트를 38400bps로 설정</td></tr>
<tr><td>AT+BAUD7</td><td>OK57600</td><td>보레이트를 57600bps로 설정</td></tr>
<tr><td>AT+BAUD8</td><td>OK115200</td><td>보레이트를 115200bps로 설정</td></tr>
</tbody></table>
<div>
<br />
이 명령어를 HC-06에 전달하는 방법은 2가지 입니다.<br />
<ul>
<li>아두이노 스케치 코드로 전달한다.</li>
<li>아두이노 시리얼 모니터를 이용해서 전달한다.</li>
</ul>
<div>
<br /></div>
<div>
아두이노 스케치 코드로 전달하는 예는 아래와 같습니다.</div>
<div>
<br /></div>
<br />
<div>
<span style="color: blue;">void</span> setup()</div>
<div>
<div>
{</div>
<div>
Serial.begin(9600);<br />
Serial.write("AT+NAMEmyHC-06"); <span style="color: #38761d;">// Change name to "myHC-06"</span></div>
<div>
}<br />
<br />
아두이노 시리얼 모니터는 아두이노 UART를 통해 사용자와 정보를 주고받을 수 있는 유틸리티이며 Arduino IDE에 포함되어있습니다.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://rydepier.files.wordpress.com/2014/08/image6.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="320" src="https://rydepier.files.wordpress.com/2014/08/image6.jpg" width="297" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">시리얼 모니터를 통해 아두이노 보드 상태를 알 수 있다.</td></tr>
</tbody></table>
<br />
시리얼 모니터를 통해 AT Command를 전달하려면 아두이노 스케치가 중간에서 역할을 해줘야 합니다.<br />
다음 스케치 소스는 시리얼 모니터를 통해 HC-06에 AT Command를 전달할 수 있게 해줍니다.<br />
<br />
<span style="color: blue;">#include</span><SoftwareSerial.h><br />
<br />
SoftwareSerial softSerial(10, 11);<br />
<br />
<span style="color: blue;">void</span> setup()<br />
{<br />
Serial.begin(9600);<br />
softSerial.begin(9600);<br />
}<br />
<br />
<span style="color: blue;">void</span> loop()<br />
{<br />
<span style="color: blue;">while</span>(Serial.available() > 0)<br />
{<br />
char command = Serial.read();<br />
softSerial.write(command);<br />
}<br />
<br />
<span style="color: blue;">while</span>(softSerial.available() > 0)<br />
{<br />
char response = softSerial.read();<br />
Serial.write(response);<br />
}<br />
}<br />
<br />
<br />
마지막으로 다룰 내용은 고속 통신 방법에 관한 것입니다.<br />
HC-06은 115200bps까지 통신 속도를 올릴 수 있습니다. 물론, 이 통신 속도는 앞에서 언급한 AT Command를 이용해서 설정해야 합니다.<br />
앞에서는 SoftwareSerial을 이용해서 아두이노 보드와 HC-06이 통신하는 방법을 설명했는데, SoftwareSerial은 높은 보레이트에서 안정적이지 않아서 통신이 잘 되지 않습니다. 알려진바로는 9600bps 이상을 넘어가면 통신이 되지 않는다고 합니다.<br />
따라서, SoftwareSerial을 사용할 때는 9600bps로 설정할 것을 권장드립니다.<br />
만약, 그 이상의 보레이트를 원하는 경우는 UART에 연결해서 사용해야 합니다.<br />
하지만, HC-06 3.3v 타입의 경우는 전압 분배 회로를 사용한다해도 UART 연결 시 통신이 잘 되지 않을 수 있습니다.<br />
그 이유는 고속 통신 시에는 정보 손실을 최소화하기 위한 부가 회로들이 필요한데, 전압 분배 회로만으로는 해결되지 않기 때문입니다.<br />
이 문제는 아주 전문적인 내용이기때문에 아두이노에서 해결하는 것은 맞지 않습니다.<br />
<span style="color: red;"><u>따라서, 되도록이면 HC-06 5V 타입을 사용할 것을 권장합니다.</u></span><br />
<br />
<br />
<br /></div>
</div>
</div>
Anonymoushttp://www.blogger.com/profile/10315630713623521810noreply@blogger.com1tag:blogger.com,1999:blog-2144160700871786133.post-10555530741665261072016-10-03T12:19:00.000+09:002016-10-03T12:19:45.560+09:00CommBluetooth아두니티에서 블루투스 통신을 하려면 CommBluetooth를 사용해야 합니다.<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgkKcY-HQP-xnQk95YOmq5IbIx-_6YO2wqxh8xU_AYaCEPWPETMl65GcyJgxVxCq_D6I9wYSVv7HG_tw97aD1zDdjF8EJePmsks_E6UO0vchFnNXblDfrXbOrne9NUkRgNpCHjHRzpiuvo/s1600/CommBluetooth+Menu.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="112" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgkKcY-HQP-xnQk95YOmq5IbIx-_6YO2wqxh8xU_AYaCEPWPETMl65GcyJgxVxCq_D6I9wYSVv7HG_tw97aD1zDdjF8EJePmsks_E6UO0vchFnNXblDfrXbOrne9NUkRgNpCHjHRzpiuvo/s400/CommBluetooth+Menu.png" width="400" /></a></div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgkF4CBb4p4TB19UOqt6e12MDoT74CBWZSt4mJFArD6MRKEMP-Hs5-vKWiZlDojuEZ1sR9BvHss2hGGeMHJi9DvlogWeZE3JuP2M4kVwOHcaSHTEMyLhCqeNOyHjy5Y38K3J1L7qJmyxb4/s1600/CommBluetooth+Block.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="109" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgkF4CBb4p4TB19UOqt6e12MDoT74CBWZSt4mJFArD6MRKEMP-Hs5-vKWiZlDojuEZ1sR9BvHss2hGGeMHJi9DvlogWeZE3JuP2M4kVwOHcaSHTEMyLhCqeNOyHjy5Y38K3J1L7qJmyxb4/s200/CommBluetooth+Block.png" width="200" /></a></div>
<div>
<br /></div>
<div>
CommBluetooth는 Bluetooth SPP 통신을 의미하고 안드로이드에서만 사용할 수 있습니다.</div>
<div>
PC에서 블루투스 통신을 할 때는 CommBluetooth가 아닌 CommSerial을 사용해야 합니다. 그 이유는 Windows/Mac에서는 Bluetooth SPP가 시리얼 포트를 통해 이루어지기 때문입니다.</div>
<div>
CommBluetooth가 iOS를 지원하지 않는 이유는 Bluetooth SPP의 경우 Apple에 별도 인증을 받은 모듈만 가능하기 때문입니다.</div>
<div>
즉, 일반 블루투스 장치를 통해 Bluetooth SPP 통신을 하려면 안드로이드에서만 가능합니다.</div>
<div>
CommBluetooth의 Inspector 설정은 다음과 같습니다.</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjA_GKSv6BMhI9BXCgObxJvS0gh2HuvdQb6Lc0ajcpgNduNYIfPhWRqkYFKaaUNEc640zPZDf3tYfIglO_4pXpndBZmtPqrotZZMvHh__mxFAT0Hbv02THPug7OaC3zD28Qg0nMOjrzwz8/s1600/CommBluetooth+Inspector.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjA_GKSv6BMhI9BXCgObxJvS0gh2HuvdQb6Lc0ajcpgNduNYIfPhWRqkYFKaaUNEc640zPZDf3tYfIglO_4pXpndBZmtPqrotZZMvHh__mxFAT0Hbv02THPug7OaC3zD28Qg0nMOjrzwz8/s400/CommBluetooth+Inspector.png" width="175" /></a></div>
<div>
<ul>
<li>searchTimeout: 블루투스 장치 검색 시간</li>
<li>OnOpen: 블루투스 장치가 연결되었을 때</li>
<li>OnClose: 블루투스 장치 연결이 해제되었을 때</li>
<li>OnOpenFailed: 블루투스 장치 연결을 실패했을 때</li>
<li>OnErrorClosed: 블루트스 장치 연결이 강제로 해제되었을 때</li>
<li>OnStartSearch: 블루투스 장치 검색이 시작되었을 때</li>
<li>OnStopSearch: 블루투스 장치 검색이 종료되었을 때</li>
</ul>
<div>
CommBluetooth를 사용하려면 ArdunityApp과 연결되어야 합니다.</div>
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiuB97pS2UXmRYPGH9knliKPnIkWPUFc7BwGWUSd_PULSHGYL0ULXa8s4ilYzPq0jyG9tOcdvhgNnvx-vRRTgLkovpQ8j6tGzCskaea3thU1k-KZ_h2EZoPptKxV32Ag-R4Ne7qeXpRTD0/s1600/CommBluetooth+Wiring.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="110" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiuB97pS2UXmRYPGH9knliKPnIkWPUFc7BwGWUSd_PULSHGYL0ULXa8s4ilYzPq0jyG9tOcdvhgNnvx-vRRTgLkovpQ8j6tGzCskaea3thU1k-KZ_h2EZoPptKxV32Ag-R4Ne7qeXpRTD0/s320/CommBluetooth+Wiring.png" width="320" /></a></div>
<div>
<br /></div>
<div>
유니티 에디터에서는 CommBluetooth를 테스트할 수 없는데, 그 이유는 실제 안드로이드 기기에서만 작동되기 때문입니다.</div>
<div>
<u><span style="color: red;">따라서, 회로 작동 제어를 테스트할 때는 CommSerial을 사용하고 안드로이드 기기에서 테스트할 때만 CommBluetooth를 연결하여 사용할 것을 추천합니다.</span></u></div>
<div>
유니티 에디터에서 테스트할 때는 각 컴포넌트의 Inspector 메뉴를 사용할 수 있었지만, 빌드가 된 이후에는 오직 GUI로만 테스트해야 합니다.</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://docs.unity3d.com/401/Documentation/Images/manual/Inspector-0.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="320" src="https://docs.unity3d.com/401/Documentation/Images/manual/Inspector-0.jpg" width="160" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">유니티 에디터에서는 Inspector 메뉴를 이용해 테스트할 수 있다.</td></tr>
</tbody></table>
<div>
<br /></div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://thumbnail.egloos.net/600x0/http://pds27.egloos.com/pds/201503/02/47/a0027147_54f404cb6e298.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://thumbnail.egloos.net/600x0/http://pds27.egloos.com/pds/201503/02/47/a0027147_54f404cb6e298.png" height="160" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">유니티 빌드 후에는 GUI가 있어야 테스트할 수 있다.</td></tr>
</tbody></table>
<div>
<br /></div>
<div>
이 말은 CommBluetooth를 사용하기 위해서는 먼저 유니티 UI로 사용자가 조작할 수 있는 GUI를 만들어줘야 한다는 의미입니다.</div>
<div>
아두니티에는 CommBluetooth 테스트를 위해 예제를 제공하고 있습니다.</div>
<div>
(ARDUnity/Examples/ConnectionUI/BluetoothConnection)</div>
<div>
이 예제를 사용하면 CommBluetooth를 위한 GUI를 쉽게 구현할 수 있습니다.</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjE0Ybb9Q81E8ukiaCh8XKa7n1S2NqLfSW93ADE8-d_e6bqhEvI98s-bAbUmzg196nK7oDsarwwNTu73djGBE7iyUlUNMV9Qi_2pqyTbB5Ys_hEBwgl3blVtvq9NwUqNEvaeUnjJnJG1nE/s1600/CommBluetooth+UI1.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="167" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjE0Ybb9Q81E8ukiaCh8XKa7n1S2NqLfSW93ADE8-d_e6bqhEvI98s-bAbUmzg196nK7oDsarwwNTu73djGBE7iyUlUNMV9Qi_2pqyTbB5Ys_hEBwgl3blVtvq9NwUqNEvaeUnjJnJG1nE/s320/CommBluetooth+UI1.png" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">기본으로 Connect/Quit 버튼이 생깁니다.</td></tr>
</tbody></table>
<div>
<br /></div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEheMUItfYGiLBi4aZcPok2kIj3faxCg4l1oqu1OScs08CYfzSL6W1WrUExPWEFl47OoDY-0HWqoA2q57VKl5Gi304rn7s6WAyIyHtXd77tM3LNx8cCADS3LIe7JHumQp0AZwodjqGPM4yI/s1600/CommBluetooth+UI2.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEheMUItfYGiLBi4aZcPok2kIj3faxCg4l1oqu1OScs08CYfzSL6W1WrUExPWEFl47OoDY-0HWqoA2q57VKl5Gi304rn7s6WAyIyHtXd77tM3LNx8cCADS3LIe7JHumQp0AZwodjqGPM4yI/s320/CommBluetooth+UI2.png" width="221" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">블루투스 장치 검색 및 선택을 위한 UI가 있습니다.</td></tr>
</tbody></table>
<div>
<br /></div>
<div>
이제 남은 것은 유니티에서 안드로이드 빌드를 해서 APK파일을 만드는 것입니다.</div>
<div>
유니티에서 안드로이드 빌드 절차는 "<a href="http://ardunityproject.blogspot.kr/2016/09/blog-post_30.html" target="_blank">유니티 안드로이드 빌드</a>" 글을 참고하시기 바랍니다.</div>
<div>
<u><span style="color: red;">그냥 안드로이드 빌드를 하면 블루투스 장치가 검색되지 않는 문제를 겪게 될 것입니다.</span></u></div>
<div>
이 문제가 발생하는 이유는 한 가지를 빼먹었기 때문인데, 바로 AndroidManifest.xml을 수정하지 않았기 때문입니다.</div>
<div>
<br /></div>
<div>
모든 안드로이드 앱은 AndroidManifest.xml을 갖고 있으며 이 파일에는 앱 관리 및 실행에 필요한 모든 정보가 기입되어 있습니다.</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://i.stack.imgur.com/LZNi5.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://i.stack.imgur.com/LZNi5.png" height="243" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">AndroidManifest.xml 파일의 내용 예</td></tr>
</tbody></table>
<div>
<br /></div>
<div>
여러분이 이 파일을 직접 작성하는 것이 아니고 Android Studio와 같은 안드로이드 앱 개발 도구가 자동으로 만들어줍니다.</div>
<div>
유니티도 마찬가지로 AndroidManifest.xml 파일을 자동으로 만들어주기때문에 여러분들이 신경쓸 필요가 없었습니다.</div>
<div>
<u><span style="color: red;">문제는 유니티가 제공해주지 않는 기능을 사용할 때는 여러분이 직접 AndroidManifest.xml을 수정해야 한다는 것입니다.</span></u></div>
<div>
블루투스 통신은 유니티가 제공하지 않는 기능입니다. 안드로이드 블루투스와 유니티가 서로 연결되도록 하는 것은 아두니티의 역할입니다.</div>
<div>
그러나, 여러분이 만든 앱의 실행 권한은 여러분이 직접 AndroidManifest.xml에 기입해줘야 합니다.</div>
<div>
작성할 주 내용은 다음과 같습니다.</div>
<div>
<ul>
<li>본 앱은 블루투스 장치를 사용합니다.<br /><i><span style="color: #bf9000;"><uses-permission android:name="android.permission.BLUETOOTH"/></span></i></li>
<li>본 앱은 블루투스 장치 관리자 권한이 필요합니다.<br /><i><span style="color: #bf9000;"><uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/></span></i></li>
<li>본 앱이 실행하는 기기에는 블루투스 장치가 내장되어야 합니다.<br /><i><span style="color: #bf9000;"><uses-feature android:name="android.hardware.bluetooth" android:required="true"/></span></i></li>
</ul>
</div>
<div>
위와 같은 내용을 AndroidManifest.xml에 삽입해야 블루투스 장치를 검색하고 테스트할 수 있습니다.</div>
<div>
<br /></div>
<div>
아두니티는 이런 번거로움을 최소화하기 위해 미리 수정된 AndroidManifest.xml 파일을 제공합니다. 따라서, 여러분은 이 파일을 사용하면 AndroidManifest.xml파일을 찾거나 수정하는 번거로움없이 블루투스 통신을 성공할 수 있습니다.</div>
<div>
먼저, 아두니티 에셋에서 AndroidManifest.xml파일을 찾습니다.<br />(ARDUnity/Plugins/Android/AndroidManifest.xml)<br />그 다음으로 Project Window에서 <u><span style="color: red;">Plugins/Android</span></u> 폴더를 만듭니다.</div>
<div>
<u><span style="color: red;">이 에셋 폴더를 만드는 이유는 유니티가 수정된 AndroidManifest.xml를 Plugins/Android 폴더에서 찾기 때문입니다.</span></u></div>
<div>
마지막으로 아두니티 에셋에 있는 AndroidManifest.xml 파일을 복사하여 앞에서 만든 Plugins/Android 폴더에 넣습니다.</div>
<div>
<br /></div>
<div>
이 과정을 마친 다음 다시 유니티에서 안드로이드 빌드를 한 후 스마트 기기에서 앱을 실행하면 블루투스 장치가 검색되는 것을 확인할 수 있습니다.</div>
<div>
<br /></div>
<div>
만약, 다른 에셋이 이미 수정된 AndroidManifest.xml을 사용하고 있어서 아두니티 에셋의 AndroidManifest.xml파일을 복사할 수 없는 경우는 앞에서 언급한 내용을 직접 이미 사용 중인 AndroidManifest.xml에 삽입하면 됩니다.</div>
<div>
<br /></div>
Anonymoushttp://www.blogger.com/profile/10315630713623521810noreply@blogger.com5tag:blogger.com,1999:blog-2144160700871786133.post-80867750055294171242016-10-03T00:16:00.001+09:002016-10-03T00:17:43.008+09:00버저(Buzzer) 다루기버저(Buzzer)는 소리를 낼 수 있는 대표적인 부품입니다.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://shallowsky.com/arduino/class/buzzer.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://shallowsky.com/arduino/class/buzzer.jpg" height="200" width="200" /></a></div>
<br />
버저의 원리는 얇은 전극판을 전기적 신호로 떨리게 만들어서 소리를 내는 것입니다. 여기서 소리를 내는 전기적 신호는 진동수(Frequency)를 의미하며 Digital 신호로 이 효과를 만들어 냅니다.<br />
버저를 제어하는 아두이노 회로도는 다음과 같습니다.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhDeTkVG_63CdAkir9H5KNL3ZTZ-lg0BBla1qlP3diK5YjYB5osjcR-JmD6LZS6LM7Vq3vCdwhF2brf4YHle4Y6zX016DJ_eVaSuHUPNFlzI4nIPwHiBWB_yN1J5vhObk2HY2ClnP9JJmg/s1600/Buzzer+Circuit.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="270" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhDeTkVG_63CdAkir9H5KNL3ZTZ-lg0BBla1qlP3diK5YjYB5osjcR-JmD6LZS6LM7Vq3vCdwhF2brf4YHle4Y6zX016DJ_eVaSuHUPNFlzI4nIPwHiBWB_yN1J5vhObk2HY2ClnP9JJmg/s400/Buzzer+Circuit.png" width="400" /></a></div>
<br />
이 회로에서 쓰는 저항의 역할은 소리 볼륨(Volume)을 조절하는 것입니다. 저항의 크기가 클수록 소리 크기가 작아지고 저항의 크기가 작을수록 소리 크기는 커집니다.<br />
이 회로를 유니티에서 다룰려면 아두니티 Wire Editor에서 다음과 같이 연결합니다.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjdY3nbdIBIulPzTlfGWjpTtx_9DCjzk2y1STe3h4fyIf1YiW0HuMaH3LaV6RPFlRe_aiRfrp_9oWiukg_yzFSxF1NZMVr1G_SipmYA81YTIDD164QiBqzPGZIdqyvYgXLkyyR9JgMpWgM/s1600/GenericTone+Wiring.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="156" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjdY3nbdIBIulPzTlfGWjpTtx_9DCjzk2y1STe3h4fyIf1YiW0HuMaH3LaV6RPFlRe_aiRfrp_9oWiukg_yzFSxF1NZMVr1G_SipmYA81YTIDD164QiBqzPGZIdqyvYgXLkyyR9JgMpWgM/s400/GenericTone+Wiring.png" width="400" /></a></div>
<br />
아두이노 스케치를 Export하고 Upload하면 유니티에서 버저를 제어할 준비가 끝납니다.<br />
아두이노 보드를 연결한 후, GenericTone의 ToneFrequency를 변경하면 버저에서 소리가 납니다.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjAhMJEcG3Ca4tccBlmlJj26aN3ak2Qa1VCaSZZSSlAviFS2T5oXZdH23Oy5DupkUYwspYuvYbt2Y0R9lZOQMCN29fEMN-gsWL-sHTuFrSKxun1H0MHf1Z9fQM2Zp74IGxIx5I3BnCOow8/s1600/GenericTone+Inspector.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="153" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjAhMJEcG3Ca4tccBlmlJj26aN3ak2Qa1VCaSZZSSlAviFS2T5oXZdH23Oy5DupkUYwspYuvYbt2Y0R9lZOQMCN29fEMN-gsWL-sHTuFrSKxun1H0MHf1Z9fQM2Zp74IGxIx5I3BnCOow8/s320/GenericTone+Inspector.png" width="320" /></a></div>
<br />
<br />
<br />
<b>전자 피아노 만들기</b><br />
유니티의 UI Button으로 버저 음계를 선택하도록 한다면 전자 피아노를 쉽게 만들 수 있습니다.<br />
우선, 음계를 제어할 UI Button을 만듭니다.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg_qyB7NU12dQBJabTSmVCAX_r7_LeHGx4khbbSaMnbOaEb3WSgVzrayAGcK90OpJAzy6ILfmMO4I-Sv5SLxf8d1PKKSOrljkTLQXgQyeNyOqlf-gO8KH0j26fkTEEL1b08RdHg_q95sZo/s1600/Buzzer+Example.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="238" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg_qyB7NU12dQBJabTSmVCAX_r7_LeHGx4khbbSaMnbOaEb3WSgVzrayAGcK90OpJAzy6ILfmMO4I-Sv5SLxf8d1PKKSOrljkTLQXgQyeNyOqlf-gO8KH0j26fkTEEL1b08RdHg_q95sZo/s320/Buzzer+Example.png" width="320" /></a></div>
<br />
각 버튼이 눌릴때마다 GenericTone의 ToneFrequency를 변경하면 됩니다.<br />
ButtonReactor를 사용하면 버튼의 눌림 상태를 알아낼 수 있습니다.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg7Leg1JOO0TqGUsTawXOwBt0-HwZ7TSfZV_yhTyNuLcG8kh-W7V0TPo86z2J519ofYOCp_YLIAg-J2Wq3WUghO56wnmgv7LJfUZ0CErHZ4CW9-P_Kq0747i80h7vzrnAtuRybWCznsrCA/s1600/ButtonReactorBlock.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="200" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg7Leg1JOO0TqGUsTawXOwBt0-HwZ7TSfZV_yhTyNuLcG8kh-W7V0TPo86z2J519ofYOCp_YLIAg-J2Wq3WUghO56wnmgv7LJfUZ0CErHZ4CW9-P_Kq0747i80h7vzrnAtuRybWCznsrCA/s200/ButtonReactorBlock.png" width="200" /></a></div>
<br />
그러나, ButtonReactor는 ToneFrequency 값을 바꿀 수는 없기에 이 역할을 할 기능이 필요합니다.<br />
ToneOutput은 지정한 ToneFrequency 값을 GenericTone에게 전달할 수 있는 기능을 갖고 있습니다.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhnlM7wzrwhRQitzcM62RfWD6JgnMsiXBpbtoCU_K3x8Gx6W8PPzT295xspJDgwQZUYtROlkShI7oLtS5uSZredI4wyvLNEG13HFbsR4B6ufT0zITVpLJOP0tqTi2lEPNdxGD1lyoAvVG0/s1600/ToneOutput+Menu.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="116" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhnlM7wzrwhRQitzcM62RfWD6JgnMsiXBpbtoCU_K3x8Gx6W8PPzT295xspJDgwQZUYtROlkShI7oLtS5uSZredI4wyvLNEG13HFbsR4B6ufT0zITVpLJOP0tqTi2lEPNdxGD1lyoAvVG0/s400/ToneOutput+Menu.png" width="400" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi90UZXnfr7WmdKLilqnfNs1YeDKsdIbwM39w7Pmx1qX5_q8HwbxDvlKenXZI73ZWotobOs6DggAnrguW24M1ytcbDaqX44lNxHF86R3dhk0PowIh2oxw1gFSzAQ4-i3cm4rdMvpLqLmoA/s1600/ToneOutput+Block.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="191" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi90UZXnfr7WmdKLilqnfNs1YeDKsdIbwM39w7Pmx1qX5_q8HwbxDvlKenXZI73ZWotobOs6DggAnrguW24M1ytcbDaqX44lNxHF86R3dhk0PowIh2oxw1gFSzAQ4-i3cm4rdMvpLqLmoA/s200/ToneOutput+Block.png" width="200" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg9fvWqJJr7XaSB1aZniEL3eLPBCE32JCxK6m8HNZCtLRJRuE-CTMIcyMBqDjeIS0ZVUhuESjefaEwTZHrW3Lh20kJ-9G5xgacP_wMdCEC4wiPgXdI-C_JEXbZmAgLIu3bjDs2a53F_GMc/s1600/ToneOutput+Inspector.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="92" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg9fvWqJJr7XaSB1aZniEL3eLPBCE32JCxK6m8HNZCtLRJRuE-CTMIcyMBqDjeIS0ZVUhuESjefaEwTZHrW3Lh20kJ-9G5xgacP_wMdCEC4wiPgXdI-C_JEXbZmAgLIu3bjDs2a53F_GMc/s400/ToneOutput+Inspector.png" width="400" /></a></div>
<br />
ToneOutput에 필요한 ToneFrequency를 선택하고 GenericTone에 연결하면 됩니다.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgDc6A2fsFTIEg83fAjv7y9qLdO0gAMujqIsRme7ywwdVtIhk67mfH2yV2y3kKpdWWLTAJxzHJQ-XNVeeHwJssWeU58E8inpGAwiGFTU6CA43S5mu7NnJbT82FfTxz2rjbn0wqqztqGXIE/s1600/Buzzer+Example1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="372" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgDc6A2fsFTIEg83fAjv7y9qLdO0gAMujqIsRme7ywwdVtIhk67mfH2yV2y3kKpdWWLTAJxzHJQ-XNVeeHwJssWeU58E8inpGAwiGFTU6CA43S5mu7NnJbT82FfTxz2rjbn0wqqztqGXIE/s400/Buzzer+Example1.png" width="400" /></a></div>
<br />
<br />
<br />
<b>전자 기타 소리 내기</b><br />
ToneFrequency를 사용하면 버저의 음계를 쉽게 잡을 수 있습니다. 그러나, 음계간의 부드러운 소리 연결이나 바이브레이션(Vibration)등의 소리 효과는 내기가 어렵습니다.<br />
CurveOutput을 이용하면 쉽게 이런 효과를 낼 수 있습니다.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-qMaqj0rXLSBRdjixFxvDVHDaqDKJwgQeYJsOMK-Js63Sr_bIllLUN6_4mVDVd15p9DBqi81orsazTFXyJRKprZbvwM0AW0t17Qi3KWbPzk15lLIKmrNQPxrOnSBi9gO2yQs8XXZgwVQ/s1600/CurveOutput+Block.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="177" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-qMaqj0rXLSBRdjixFxvDVHDaqDKJwgQeYJsOMK-Js63Sr_bIllLUN6_4mVDVd15p9DBqi81orsazTFXyJRKprZbvwM0AW0t17Qi3KWbPzk15lLIKmrNQPxrOnSBi9gO2yQs8XXZgwVQ/s200/CurveOutput+Block.png" width="200" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhLmyrljadCkbdXTcKnz5D6LMwb-HbItfzyPQn9-Y01mBKil3wae8EV_-ZskMB5p7oYa-c-AjjiQI9yYBdUZ_hEWQTeLxtc0N2oyELWJ2QCU1j4kErURbC65YI-PRwADiGSfZ15zxtzXLg/s1600/CurveOutput+Inspector.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="256" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhLmyrljadCkbdXTcKnz5D6LMwb-HbItfzyPQn9-Y01mBKil3wae8EV_-ZskMB5p7oYa-c-AjjiQI9yYBdUZ_hEWQTeLxtc0N2oyELWJ2QCU1j4kErURbC65YI-PRwADiGSfZ15zxtzXLg/s320/CurveOutput+Inspector.png" width="320" /></a></div>
<br />
CurveOutput의 Start/Loop/End Curve를 아래와 같이 만들어주면 마치 전자 기타 소리같은 효과를 낼 수 있습니다.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFYU-79DRlmN5srrYOFYIW-qMMK-pU-OviMc2A_jnWB2jtJYfDozML500wA4k4R1SPfQzC1TiXMLuSkVDu9oNMQxv2XlPCiUwZzGgROYXyTVtCaGinOgMXIcTaLGFglnerMnKySudTXIQ/s1600/Buzzer+Vibration.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="220" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFYU-79DRlmN5srrYOFYIW-qMMK-pU-OviMc2A_jnWB2jtJYfDozML500wA4k4R1SPfQzC1TiXMLuSkVDu9oNMQxv2XlPCiUwZzGgROYXyTVtCaGinOgMXIcTaLGFglnerMnKySudTXIQ/s320/Buzzer+Vibration.png" width="320" /></a></div>
<br />
CurveOutput과 ToneOutput을 결합하면 ToneFrequency값이 Curve형태로 전달됩니다.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjhYy_8rra-BVCUNO1VBBBwdTxY0gtuQzOBdro4t2fCHz_eDvJjtf4XiXkDQCvY-1zxhVUgtSY25Mu8psfoarZcd4NiL53p7fV8j7Lig9OoS_XtoEaIq-ErAHZpnuvgLhB1qfey8jwBx00/s1600/Buzzer+Example2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="142" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjhYy_8rra-BVCUNO1VBBBwdTxY0gtuQzOBdro4t2fCHz_eDvJjtf4XiXkDQCvY-1zxhVUgtSY25Mu8psfoarZcd4NiL53p7fV8j7Lig9OoS_XtoEaIq-ErAHZpnuvgLhB1qfey8jwBx00/s400/Buzzer+Example2.png" width="400" /></a></div>
<br />
<br />
<br />
<b>RTTTL Song</b><br />
버저를 활용할 때 빠질 수 없는 것은 멜로디 연주입니다. 음악은 악보로 표현되고 이 악보를 컴퓨터로 표현하려면 아주 많은 노력이 필요합니다.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://upload.wikimedia.org/wikipedia/commons/thumb/4/41/Adeste_Fideles_sheet_music_sample.svg/350px-Adeste_Fideles_sheet_music_sample.svg.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="108" src="https://upload.wikimedia.org/wikipedia/commons/thumb/4/41/Adeste_Fideles_sheet_music_sample.svg/350px-Adeste_Fideles_sheet_music_sample.svg.png" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">악보에는 음악 표현에 필요한 정보가 포함되어 있다.</td></tr>
</tbody></table>
<br />
일반적으로 음악을 표현하려면 다음과 같은 정보가 필요합니다.<br />
<ul>
<li>음의 순서</li>
<li>연주 속도</li>
<li>음의 길이</li>
<li>음의 높낮이</li>
</ul>
<div>
따라서, 이와 같은 모든 정보를 코드로 표현하려면 프로그램이 매우 복잡해집니다. 더 큰 문제는 곡마다 이 정보가 다르므로 매번 다르게 만들어야 한다는 것입니다.</div>
<div>
RTTTL(Ring Tone Text Transfer Language)는 핸드폰 벨소리를 표현하기 위해 노키아(Nokia)에서 제정한 멜로디 표현에 대한 표준 규격입니다. (<a href="https://en.wikipedia.org/wiki/Ring_Tone_Transfer_Language" target="_blank">위키피디아에서 RTTTL에 대해 알아보기</a>)</div>
<div>
RTTTL을 이용하면 멜로디 연주를 아주 쉽게 할 수 있습니다.</div>
<div>
RTTTL Song은 인터넷에서 쉽게 구할 수 있고, 그 문법이 간단하기 때문에 자신이 직접 음악을 만들 수도 있습니다.</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhSIeojmiD88oK_gccL3VAw7pYQ2ltaS0ORsKuAybJu-W1tSZ3ie8_kEXL9Pjv6bvZpfR9fBMzOTJzAw6pWAnYNIJRNj_fBKjZeUwGHg5ovg_PIIe45blLViS1kW39bKRWKUjU91B-9Glo/s1600/RTTTL+Menu.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="115" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhSIeojmiD88oK_gccL3VAw7pYQ2ltaS0ORsKuAybJu-W1tSZ3ie8_kEXL9Pjv6bvZpfR9fBMzOTJzAw6pWAnYNIJRNj_fBKjZeUwGHg5ovg_PIIe45blLViS1kW39bKRWKUjU91B-9Glo/s400/RTTTL+Menu.png" width="400" /></a></div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgHQtklmq0UQzyCZCcBppQybY6cdZewRO9qQD4C0Wie_9Cogs49u64_0YoRnMAyGlJzPnVH46FnHsE0dzTmYIutT3Omy9egoBC2tcjBuuMx9T5Ois5SHVbCbxrxHV6XiTSt_s1lft1PORg/s1600/RTTTL+Block.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="191" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgHQtklmq0UQzyCZCcBppQybY6cdZewRO9qQD4C0Wie_9Cogs49u64_0YoRnMAyGlJzPnVH46FnHsE0dzTmYIutT3Omy9egoBC2tcjBuuMx9T5Ois5SHVbCbxrxHV6XiTSt_s1lft1PORg/s200/RTTTL+Block.png" width="200" /></a></div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgqV-tt-yU3EpEbb1A3pmLa6r4xJ7xmC3cvp6fDxwz2vPcV3mGJRuGzEuoR_bTiBabOgciYiu3thuVqSXxBbFTyT70U4V-7D3RS_4zLeeh4gk1yIW7dQPQrK8syl136tg3U6yhkfByEMKc/s1600/RTTTL+Inspector.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="177" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgqV-tt-yU3EpEbb1A3pmLa6r4xJ7xmC3cvp6fDxwz2vPcV3mGJRuGzEuoR_bTiBabOgciYiu3thuVqSXxBbFTyT70U4V-7D3RS_4zLeeh4gk1yIW7dQPQrK8syl136tg3U6yhkfByEMKc/s320/RTTTL+Inspector.png" width="320" /></a></div>
<div>
<br /></div>
<div>
<ul>
<li>songAsset: RTTTL Song이 기입된 Text 파일</li>
</ul>
<div>
<br /></div>
<div>
아두니티 에셋에 포함된 SampleSong을 선택하고 유니티를 Play하면 SampleSong에 포함된 멜로디 목록을 선택하고 연주할 수 있습니다.</div>
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgRxFkObxvIoJiTPPjDdIoIaKycs2ONPaW2MOQd9fjOeTuzgxj4mLK57yP7TrhV9v53tslWZhDe65VNGmkJbDAWqxTL-YaesFr6AkUPtxgG-0NiJ2BXi22r3_1DynjpLTGlhp-4Xs_0p-M/s1600/RTTTL+Inspector2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="198" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgRxFkObxvIoJiTPPjDdIoIaKycs2ONPaW2MOQd9fjOeTuzgxj4mLK57yP7TrhV9v53tslWZhDe65VNGmkJbDAWqxTL-YaesFr6AkUPtxgG-0NiJ2BXi22r3_1DynjpLTGlhp-4Xs_0p-M/s320/RTTTL+Inspector2.png" width="320" /></a></div>
<div>
<br /></div>
<div>
GenericTone과 다음과 같이 연결하면 RTTTL Song이 연주됩니다.</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEipAEeCegrJyk7Mos5UHD4KAd9kl8MPVHKnQA30hsFLRTecKpXPjLx5jixV_HQS2fmRd84O55BfBSJ0SuZhErQT18x8RC9vyhaH3NSlitr2fSrJ5YshC5PqMXTa5AuOxSiZjaJWjM-yKZs/s1600/RTTTL+Wiring.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="185" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEipAEeCegrJyk7Mos5UHD4KAd9kl8MPVHKnQA30hsFLRTecKpXPjLx5jixV_HQS2fmRd84O55BfBSJ0SuZhErQT18x8RC9vyhaH3NSlitr2fSrJ5YshC5PqMXTa5AuOxSiZjaJWjM-yKZs/s320/RTTTL+Wiring.png" width="320" /></a></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
지금까지 버저 활용을 동영상으로 확인하기 바랍니다.</div>
<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen="" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/OsWtWl0r_Qw/0.jpg" frameborder="0" height="266" src="https://www.youtube.com/embed/OsWtWl0r_Qw?feature=player_embedded" width="320"></iframe></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
Anonymoushttp://www.blogger.com/profile/10315630713623521810noreply@blogger.com0tag:blogger.com,1999:blog-2144160700871786133.post-1278020417569304222016-10-02T18:46:00.004+09:002016-10-02T18:47:54.521+09:00GenericToneGenericTone은 아두이노의 Tone라이브러리를 사용하기 위한 Controller입니다.<br />
Tone라이브러리는 Buzzer와 같은 소리를 내는 부품을 제어할 때 사용합니다.<br />
소리는 물체의 진동으로 인해 발생되기 때문에 컴퓨터가 소리를 내려면 진동을 만들어야 합니다.<br />
컴퓨터의 소리 출력 장치로 사용되는 스피커는 작은 진동도 효과적으로 전달할 수 있는 구조를 갖고 있습니다.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://cdn.shopify.com/s/files/1/0303/7725/t/2/assets/clio-emt-speaker.png?16716775750020733777" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://cdn.shopify.com/s/files/1/0303/7725/t/2/assets/clio-emt-speaker.png?16716775750020733777" height="163" width="200" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">컴퓨터의 소리 전달 장치인 스피커</td></tr>
</tbody></table>
<br />
아주 단순하면서 값싼 스피커는 피에조 부저(Piezo Buzzer)입니다. 얇은 전극판으로 이루어져서 전기적 신호의 변화로 떨림을 만들어낼 수 있는 부품입니다.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://blogspot.tenettech.com/wp-content/uploads/2014/07/CEB-27FD44.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://blogspot.tenettech.com/wp-content/uploads/2014/07/CEB-27FD44.jpg" height="200" width="200" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">피에조 부저(Piezo Buzzer)</td></tr>
</tbody></table>
<br />
소리는 신호로 표현할 수 있는데 이때 사용하는 것이 진폭(Amplitude)와 진동수(Frequency)입니다.<br />
<ul>
<li>진폭(Amplitude): 소리의 크기를 표현</li>
<li>진동수(Frequency): 소리의 높낮이를 표현</li>
</ul>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://www.mediacollege.com/audio/images/amplitude.gif" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://www.mediacollege.com/audio/images/amplitude.gif" height="152" width="200" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">진폭의 개념</td></tr>
</tbody></table>
<div>
<br /></div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://www.tv411.org/sites/default/files/Science8_A1_Q4_7-8.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://www.tv411.org/sites/default/files/Science8_A1_Q4_7-8.png" height="297" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">진동수의 개념</td></tr>
</tbody></table>
<div>
<br /></div>
<div>
현실 세계에서는 여러 종류의 진폭과 진동수가 섞여서 전달되므로 아래와 같은 그림이 될 것입니다.</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://aos.iacpublishinglabs.com/question/aq/700px-394px/lowest-frequency-sound-human-ear-can-hear_668398c9b9abccfe.jpg?domain=cx.aos.ask.com" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="180" src="https://aos.iacpublishinglabs.com/question/aq/700px-394px/lowest-frequency-sound-human-ear-can-hear_668398c9b9abccfe.jpg?domain=cx.aos.ask.com" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">현실에서의 소리 파형 모습</td></tr>
</tbody></table>
<div>
<br /></div>
<div>
아두이노 Tone 라이브러리는 멜로디 소리를 낼 수 있도록 음계(Musical Scale)에 해당되는 진동수를 쉽게 만들어 줍니다.</div>
<div>
도, 레, 미, 파 등의 음계는 모두 고유한 진동수를 갖고 있기때문에 피에조 부저에 전기 신호를 이와 같이 만들어주면 멜로디 소리를 만들 수 있습니다.</div>
<div>
GenericTone은 이와같은 음계 진동수를 제어할 때 사용합니다.</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgak2q1cZMAMiZBn_-oOMuBScgnskdOmA3lr5EqsMvD7kYBCRcaSbETaQJ0p3X4ogVyS-MNhIiQHHNrFz7GhXVl_0aN54Gm4Di41hKUnjFr3p2BUdmGXi6e-22WUe7Ql77VZnwLEeQU7xQ/s1600/GenericTone+Menu.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="90" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgak2q1cZMAMiZBn_-oOMuBScgnskdOmA3lr5EqsMvD7kYBCRcaSbETaQJ0p3X4ogVyS-MNhIiQHHNrFz7GhXVl_0aN54Gm4Di41hKUnjFr3p2BUdmGXi6e-22WUe7Ql77VZnwLEeQU7xQ/s400/GenericTone+Menu.png" width="400" /></a></div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4w0J2uKCo1qk2S-1rrsvJ9lxO1tfXlHjtFXqzC8iFecUBsKpyvRDtoc2aWSrzlcDJ0bS4RGRb5TJMDKB2Mwl7Qkc235u1FbtD79LJIAK_4u-nHlm9osPioo0oGl9lxmpiIsic4OW9_bI/s1600/GenericTone+Block.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="200" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4w0J2uKCo1qk2S-1rrsvJ9lxO1tfXlHjtFXqzC8iFecUBsKpyvRDtoc2aWSrzlcDJ0bS4RGRb5TJMDKB2Mwl7Qkc235u1FbtD79LJIAK_4u-nHlm9osPioo0oGl9lxmpiIsic4OW9_bI/s200/GenericTone+Block.png" width="155" /></a></div>
<div>
<br /></div>
<div>
GenericTone을 설정하려면 다음의 정보가 필요합니다.</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgpwOOK5TxsWQO7JpDhrm-JJPp4gwP15f_KdMoIDgrpfffXEDKnK-C3J7wctmRuhoX0RVpclhpDQ75gH1a0JHmaK0t3byuBSXWU-8qiFMSvH3UYv5xrNyT75L53UjTgslPUpEPJojWXZeo/s1600/GenericTone+Inspector.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="153" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgpwOOK5TxsWQO7JpDhrm-JJPp4gwP15f_KdMoIDgrpfffXEDKnK-C3J7wctmRuhoX0RVpclhpDQ75gH1a0JHmaK0t3byuBSXWU-8qiFMSvH3UYv5xrNyT75L53UjTgslPUpEPJojWXZeo/s320/GenericTone+Inspector.png" width="320" /></a></div>
<div>
<ul>
<li>id: ArdunityApp이 ArdunityController를 구분하기 위한 식별자</li>
<li>pin: 음계 진동수를 만들어낼 핀 번호</li>
<li>Tone Frequency: 음계 진동수</li>
<li>Mute: 소리내는 것을 멈춤</li>
</ul>
<div>
GenericTone에서는 음계 진동수를 쉽게 선택할 수 있도록 각 진동수에 이름을 붙였습니다.</div>
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgYoFxycTACH0eycFaDlqacc24__chARK3hX1kl-RoSGBlXLk0SRepqNP66JkXZiVW1bksvKlVqo4DJthOn-b8dEM4U6ND-oqBWYN59C1nP_PlRFjuFcbwnZmWz-ayNjGtpA8jFGd72K7c/s1600/ToneFrequency.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgYoFxycTACH0eycFaDlqacc24__chARK3hX1kl-RoSGBlXLk0SRepqNP66JkXZiVW1bksvKlVqo4DJthOn-b8dEM4U6ND-oqBWYN59C1nP_PlRFjuFcbwnZmWz-ayNjGtpA8jFGd72K7c/s400/ToneFrequency.png" width="102" /></a></div>
<div>
<br /></div>
<div>
이 이름 규칙을 이해하려면 먼저 국제적으로 음계를 어떻게 표기하고 있는지 알아야 합니다. 우리는 도, 레, 미, 파 등으로 부르지만 국제적으로는 C, D, E, F 등으로 표기됩니다.</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://thinkzone.wlonk.com/Music/PianoKeys.gif" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://thinkzone.wlonk.com/Music/PianoKeys.gif" height="105" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">음계 표기 방법</td></tr>
</tbody></table>
<div>
<br /></div>
<div>
반음 올림 표시인 #은 Sharp의 약자로 S만 표기하고, 제일 뒤의 숫자는 옥타브(Octave)를 뜻합니다. 따라서 DS3은 3 옥타브 D#이라는 뜻입니다.</div>
<div>
<br /></div>
<div>
아두니티에서 피에조 버저를 제어하기 위한 연결은 Wire Editor에서 다음과 같이 표현됩니다.</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiQVKXATSg9mEWRVc9PPw8xleSPs2xaeE0KDmf0urJGJElF5-_k88jBGcm5UUcCmTggr283eKGFvJrzI4Za33If0W-1RjIM_9fjTSTFFbhLBTb6d1wigBtPZNoGg6zylrMb9w-h1IbMSzo/s1600/GenericTone+Wiring.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="156" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiQVKXATSg9mEWRVc9PPw8xleSPs2xaeE0KDmf0urJGJElF5-_k88jBGcm5UUcCmTggr283eKGFvJrzI4Za33If0W-1RjIM_9fjTSTFFbhLBTb6d1wigBtPZNoGg6zylrMb9w-h1IbMSzo/s400/GenericTone+Wiring.png" width="400" /></a></div>
<div>
<br /></div>
<div>
위 정보를 아두이노 스케치로 Export한 후 Upload하면 제어할 준비가 완료됩니다.</div>
<div>
<br /></div>
<div>
GenericTone에서 사용하는 ToneFrequency는 Enum으로 다음과 같이 정의되어 있습니다. 각 숫자는 실제 진동수인 Hz를 의미합니다.</div>
<div>
<br /></div>
<pre><code class="language-csharp">using UnityEngine;
public enum ToneFrequency
{
MUTE = 0,
B0 = 31,
C1 = 33,
CS1 = 35,
D1 = 37,
DS1 = 39,
E1 = 41,
F1 = 44,
FS1 = 46,
G1 = 49,
GS1 = 52,
A1 = 55,
AS1 = 58,
B1 = 62,
C2 = 65,
CS2 = 69,
D2 = 73,
DS2 = 78,
E2 = 82,
F2 = 87,
FS2 = 93,
G2 = 98,
GS2 = 104,
A2 = 110,
AS2 = 117,
B2 = 123,
C3 = 131,
CS3 = 139,
D3 = 147,
DS3 = 156,
E3 = 165,
F3 = 175,
FS3 = 185,
G3 = 196,
GS3 = 208,
A3 = 220,
AS3 = 233,
B3 = 247,
C4 = 262,
CS4 = 277,
D4 = 294,
DS4 = 311,
E4 = 330,
F4 = 349,
FS4 = 370,
G4 = 392,
GS4 = 415,
A4 = 440,
AS4 = 466,
B4 = 494,
C5 = 523,
CS5 = 554,
D5 = 587,
DS5 = 622,
E5 = 659,
F5 = 698,
FS5 = 740,
G5 = 784,
GS5 = 831,
A5 = 880,
AS5 = 932,
B5 = 988,
C6 = 1047,
CS6 = 1109,
D6 = 1175,
DS6 = 1245,
E6 = 1319,
F6 = 1397,
FS6 = 1480,
G6 = 1568,
GS6 = 1661,
A6 = 1760,
AS6 = 1865,
B6 = 1976,
C7 = 2093,
CS7 = 2217,
D7 = 2349,
DS7 = 2489,
E7 = 2637,
F7 = 2794,
FS7 = 2960,
G7 = 3136,
GS7 = 3322,
A7 = 3520,
AS7 = 3729,
B7 = 3951,
C8 = 4186,
CS8 = 4435,
D8 = 4699,
DS8 = 4978
}
</code>
</pre>
<div>
다음 예제는 아두이노 보드가 연결되면 1초에 한번씩 도, 레, 미, 파, 솔, 라, 시, 도를 연주합니다.</div>
<div>
<br /></div>
<pre><code class="language-csharp">using UnityEngine;
using System.Collections;
using Ardunity;
public class MyComponent : MonoBehaviour
{
public GenericTone genericTone;
private float _time = 0f;
private int _musicalScale = 0;
void Update ()
{
if(genericTone.connected)
{
_time += Time.deltaTime;
if(_time >= 1f) // per 1 second
{
_time = 0f;
switch(_musicalScale)
{
case 0:
genericTone.toneFrequency = ToneFrequency.C3;
break;
case 1:
genericTone.toneFrequency = ToneFrequency.D3;
break;
case 2:
genericTone.toneFrequency = ToneFrequency.E3;
break;
case 3:
genericTone.toneFrequency = ToneFrequency.F3;
break;
case 4:
genericTone.toneFrequency = ToneFrequency.G3;
break;
case 5:
genericTone.toneFrequency = ToneFrequency.A3;
break;
case 6:
genericTone.toneFrequency = ToneFrequency.B3;
break;
case 7:
genericTone.toneFrequency = ToneFrequency.C4;
break;
}
_musicalScale++; // Increase Musical Scale
if(_musicalScale > 7)
_musicalScale = 0;
}
}
}
</code>
</pre>
<div>
<br /></div>
Anonymoushttp://www.blogger.com/profile/10315630713623521810noreply@blogger.com0tag:blogger.com,1999:blog-2144160700871786133.post-15330337083653491622016-10-02T00:29:00.001+09:002016-10-02T00:29:17.325+09:00DC 모터 다루기DC 모터를 다루기 위해서는 H-bridge 회로가 필요합니다.<div class="separator" style="clear: both; text-align: center;">
<a href="http://www.mind.ilstu.edu/curriculum/medical_robotics/dcmotor.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://www.mind.ilstu.edu/curriculum/medical_robotics/dcmotor.jpg" height="146" width="200" /></a></div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://www.clear.rice.edu/elec201/Book/images/H-bridge4.gif" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="200" src="https://www.clear.rice.edu/elec201/Book/images/H-bridge4.gif" width="196" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">DC 모터를 제어하기 위한 H-Bridge 회로</td></tr>
</tbody></table>
<div>
<br /></div>
<div>
이 회로를 직접 만드는 것은 쉽지 않으므로 Arduino Motor Shield를 사용하거나 Motor Driver IC를 이용하는 것을 추천합니다.</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://store.arduino.cc/bmz_cache/e/e28b752b263d86e2cfac50d449f772d0.image.447x354.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="253" src="https://store.arduino.cc/bmz_cache/e/e28b752b263d86e2cfac50d449f772d0.image.447x354.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">아두이노 모터 쉴드</td></tr>
</tbody></table>
<div>
<br /></div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://electrosome.com/wp-content/uploads/2013/05/L293D.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="166" src="https://electrosome.com/wp-content/uploads/2013/05/L293D.jpg" width="200" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Motor Driver IC (L293D)</td></tr>
</tbody></table>
<div>
<br /></div>
<div>
본 포스트에서는 아두이노 모터 쉴드를 이용해서 DC 모터를 제어하는 법에 대해 설명하겠습니다. 회로도는 아래와 같습니다.</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj3Pe58Ltg7_hSbDH-zUrUyEO6JMWJs3M3_UDefp8J8vOSmvsWYj9gCO4q5GcGO6ZJsRBGsdfO8QpzPRIyWyq5qjhvY1DkKbceZGpmlq2Au4DfVRlsSdR3Qfsa7Ov1uRRGuoj1bLeDqgGg/s1600/DC+Motor+Circuit.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="271" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj3Pe58Ltg7_hSbDH-zUrUyEO6JMWJs3M3_UDefp8J8vOSmvsWYj9gCO4q5GcGO6ZJsRBGsdfO8QpzPRIyWyq5qjhvY1DkKbceZGpmlq2Au4DfVRlsSdR3Qfsa7Ov1uRRGuoj1bLeDqgGg/s400/DC+Motor+Circuit.png" width="400" /></a></div>
<div>
<br /></div>
<div>
아두이노 모터 쉴드는 DC 모터를 2개까지 연결할 수 있습니다. 이 회로를 아두니티에서 제어하기 위해 제일 먼저 해야 할 일은 GameObject 구조를 만드는 것입니다.</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEifv5woJrvaTiyqGQE9pKcOtmn9yLm_OtC0QCCxX-H5anFNDeXrEoN_iwyx-brFFi_SAikgeEL4hZIN0nhnQzqGBahyfnuJbuW5VfqT4V7UL2LvGw_Tsr4iS3P0IXaYKn86VwFT0GdWDkE/s1600/DC+Motor+GameObject.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="284" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEifv5woJrvaTiyqGQE9pKcOtmn9yLm_OtC0QCCxX-H5anFNDeXrEoN_iwyx-brFFi_SAikgeEL4hZIN0nhnQzqGBahyfnuJbuW5VfqT4V7UL2LvGw_Tsr4iS3P0IXaYKn86VwFT0GdWDkE/s320/DC+Motor+GameObject.png" width="320" /></a></div>
<br />
다음으로 아두니티 Wire Editor에서 각 GameObject에 필요한 Block을 추가하고 연결합니다.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj2PIvILdrfMOsM9coD-v7qDVZWdS72MaUdddTITnYxWoGwsojCr7yHQYf7xx6J-c8Z4AQekmm4bolbaUFeYrITfBmCOVqL2Q_B9qPTROAyL5m16KCZR78RT7Fb15VptS3LVvAVAzqnBe8/s1600/DC+Motor+Wiring.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="303" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj2PIvILdrfMOsM9coD-v7qDVZWdS72MaUdddTITnYxWoGwsojCr7yHQYf7xx6J-c8Z4AQekmm4bolbaUFeYrITfBmCOVqL2Q_B9qPTROAyL5m16KCZR78RT7Fb15VptS3LVvAVAzqnBe8/s400/DC+Motor+Wiring.png" width="400" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div>
아두이노 모터 쉴드의 경우 DC 모터는 다음과 같이 제어합니다.</div>
<div>
<ul>
<li>Direction Pin: HIGH이면 정회전, LOW이면 역회전 제어</li>
<li>PWM Pin: 모터의 회전 속도 제어</li>
</ul>
<div>
따라서, GenericMotor에서 Control Type은 One PWM_One Dir을 선택하면 됩니다.</div>
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEglNOeZ4r7q9wnlv4W8mIPT0Qtdp3IagnoGeerXe-spAJ9ZvtJGHhhf1sMD-Qk3TjskL-2GCVec9unHX0uymzwu-vf7NyI9ZpxYYoMjce8Mbfj8ALL00osE8S3HaxelxFrxFQdUeqZoxek/s1600/GenericMotor+Inspector.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="220" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEglNOeZ4r7q9wnlv4W8mIPT0Qtdp3IagnoGeerXe-spAJ9ZvtJGHhhf1sMD-Qk3TjskL-2GCVec9unHX0uymzwu-vf7NyI9ZpxYYoMjce8Mbfj8ALL00osE8S3HaxelxFrxFQdUeqZoxek/s320/GenericMotor+Inspector.png" width="320" /></a></div>
<div>
<br /></div>
<div>
아두이노 모터 쉴드의 Pin 연결은 다음과 같으니 dir pin과 pwm pin을 적절히 설정하면 됩니다.</div>
<div>
<ul>
<li>Motor A</li>
<ul>
<li>Direction Pin: 12</li>
<li>PWM Pin: 3</li>
</ul>
<li>Motor B</li>
<ul>
<li>Direction Pin: 13</li>
<li>PWM Pin: 11</li>
</ul>
</ul>
<div>
이와 같이 모든 설정을 마치고 아두이노 스케치를 Export하고 Upload하면 제어할 준비가 끝납니다.</div>
</div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<b>단계별 속도 제어</b></div>
<div>
선풍기의 경우 모터의 회전속도를 정지, 약, 중, 강으로 단계별로 제어합니다. 아두니티에서도 이와 같이 DC 모터를 제어할 수 있습니다.</div>
<div>
먼저, UI Button을 만들어서 단계별로 속도를 제어할 인터페이스를 만듭니다.</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0AUHCpyhQ7mf8PMyEPyIkfGw4Z1t69NpXm6fvc_Vwfq5fV0xPA-HUzOiGOmySNtsZCDg2XReD_iRUnEO28jLYPcI5mWZ6aqUtJ7nCThpxgZ6VAgHIAFmXZ8C658i738iVK0KkDlEaCgs/s1600/DCMotor+Example.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="300" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0AUHCpyhQ7mf8PMyEPyIkfGw4Z1t69NpXm6fvc_Vwfq5fV0xPA-HUzOiGOmySNtsZCDg2XReD_iRUnEO28jLYPcI5mWZ6aqUtJ7nCThpxgZ6VAgHIAFmXZ8C658i738iVK0KkDlEaCgs/s400/DCMotor+Example.png" width="400" /></a></div>
<div>
<br /></div>
<div>
각 Button이 눌렸을 때 반응하려면 ButtonReactor를 사용하면 됩니다.</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg7Leg1JOO0TqGUsTawXOwBt0-HwZ7TSfZV_yhTyNuLcG8kh-W7V0TPo86z2J519ofYOCp_YLIAg-J2Wq3WUghO56wnmgv7LJfUZ0CErHZ4CW9-P_Kq0747i80h7vzrnAtuRybWCznsrCA/s1600/ButtonReactorBlock.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="200" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg7Leg1JOO0TqGUsTawXOwBt0-HwZ7TSfZV_yhTyNuLcG8kh-W7V0TPo86z2J519ofYOCp_YLIAg-J2Wq3WUghO56wnmgv7LJfUZ0CErHZ4CW9-P_Kq0747i80h7vzrnAtuRybWCznsrCA/s200/ButtonReactorBlock.png" width="200" /></a></div>
<div>
<br /></div>
<div>
다음으로 할 일은 각 Button이 눌렸을 때 GenericMotor의 Value값이 바뀌도록 하면 됩니다. 이때 유용하게 사용할 수 있는 것이 ValueOutput입니다.</div>
<div>
ValueOutput은 미리 설정한 값이 Controller에 전달되도록 작동하는 Bridge입니다.</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiQmQMIWtpDYV4ZBVFIPsHAQNPX-IAfrMDPY2jPema-PV2dQp_tKYItjUa0DKB7G0UBhzUyS-tV7RU6uc0O5_0Yw7eG_hRtzNhLJNfucf_PpYTP8emK32Q1pdKQekPzHLp0WPYG2F2LPRk/s1600/ValueOutput+Menu.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="121" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiQmQMIWtpDYV4ZBVFIPsHAQNPX-IAfrMDPY2jPema-PV2dQp_tKYItjUa0DKB7G0UBhzUyS-tV7RU6uc0O5_0Yw7eG_hRtzNhLJNfucf_PpYTP8emK32Q1pdKQekPzHLp0WPYG2F2LPRk/s400/ValueOutput+Menu.png" width="400" /></a></div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjEHYMQqruT_QyjoIpIN1vo548O6RyHybw0u-4QoveOh-al2jdJGMK6IAdIa0A6KdOkFXRkCKEf_YWu0BDLld8uSsGrOORvxoBQ1cqRd1lJKr2tgJZotKOl16LJZazAquaDkTiOToMPwh0/s1600/ValueOutput+Block.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="196" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjEHYMQqruT_QyjoIpIN1vo548O6RyHybw0u-4QoveOh-al2jdJGMK6IAdIa0A6KdOkFXRkCKEf_YWu0BDLld8uSsGrOORvxoBQ1cqRd1lJKr2tgJZotKOl16LJZazAquaDkTiOToMPwh0/s200/ValueOutput+Block.png" width="200" /></a></div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjKeCfgcUiYFnGdoDpMEF-EBGkHb3hJirtuo7nyRkkS6-FWxI34ub-3Ui3ynEQwMYbtF15Kej3dZNThNdyYPZ9GBHl826GdcmKM9ESwdJ_zUXudVw4BkoF3cf_qjVFySoCwsVGeoZJU-bY/s1600/ValueOutput+Inspector.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="90" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjKeCfgcUiYFnGdoDpMEF-EBGkHb3hJirtuo7nyRkkS6-FWxI34ub-3Ui3ynEQwMYbtF15Kej3dZNThNdyYPZ9GBHl826GdcmKM9ESwdJ_zUXudVw4BkoF3cf_qjVFySoCwsVGeoZJU-bY/s400/ValueOutput+Inspector.png" width="400" /></a></div>
<div>
<br /></div>
<div>
이 ValueOutput에 GenericMotor를 제어할 각 단계별 Value를 설정하고 연결하면 됩니다.</div>
<div>
<ul>
<li>정지: Value를 0으로 설정</li>
<li>약: Value를 0.4으로 설정</li>
<li>중: Value를 0.7으로 설정</li>
<li>강: Value를 1로 설정</li>
</ul>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjLnxAhrXBiQRNYIB7pS74UjKB9uK4ubokzWqduyMDsesMLI4YZ_EKsb0TR34X5J_79evRWkrxPY_L-ZatHl651p8ZNtxTQyv6vvS6VeDcImeazdPcsHi368BIQeNJp2xN7kBco4hqb0zw/s1600/DCMotor+Example1.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjLnxAhrXBiQRNYIB7pS74UjKB9uK4ubokzWqduyMDsesMLI4YZ_EKsb0TR34X5J_79evRWkrxPY_L-ZatHl651p8ZNtxTQyv6vvS6VeDcImeazdPcsHi368BIQeNJp2xN7kBco4hqb0zw/s400/DCMotor+Example1.png" width="235" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">GenericMotor는 ValueOutput에 의해 제어된다.</td></tr>
</tbody></table>
<br />
각 ValueOutput은 Active라는 신호를 받으면 설정된 Value를 전달합니다. ButtonReactor가 Active신호를 보내도록 한다면 GenericMotor는 Button 누름에 따라 단계별로 제어될 것입니다.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhwAnIRDmY4AD8VUwNrEPnqtKzwpf7rwb7m_0eB5DADyZpmMi7Ixd_FzyKb4BT7NR8Qw7Vhj8nDjpndEknO2erfMhtY32jASupBjPH06CBBylgpFs76J_QV-7cgtRw-OwOGOz32FOUcPV0/s1600/DCMotor+Example2.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhwAnIRDmY4AD8VUwNrEPnqtKzwpf7rwb7m_0eB5DADyZpmMi7Ixd_FzyKb4BT7NR8Qw7Vhj8nDjpndEknO2erfMhtY32jASupBjPH06CBBylgpFs76J_QV-7cgtRw-OwOGOz32FOUcPV0/s400/DCMotor+Example2.png" width="357" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">ButtonReactor가 ValueOutput을 작동시킨다.</td></tr>
</tbody></table>
<div>
<br /></div>
</div>
<div>
<br /></div>
<div>
<b>가감속 제어</b></div>
<div>
모터를 제어할 때 가감속 제어는 매우 중요한 문제입니다. 가감속 제어란 회전 속도를 변경할 때 서서히 한다는 의미입니다.</div>
<div>
아두니티를 사용한다면 모터의 가감속 제어를 쉽게 할 수 있습니다.</div>
<div>
CurveOutput을 사용한다면 GenericMotor의 Value를 서서히 변하도록 만들 수 있습니다.</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgHByt6qbiyWwB3Z9_74vDzLWrrLQID3DU2sNidvSevh7Ktztx6efFEUi2Trt2xc8MVVh5PLhzJOeUYr5KYLrFS2XkLijHANRN5fyYO7CSEihUfeRHVXK89QfpwSym8L5coapKIsRf4HfA/s1600/CurveOutput+Menu.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="120" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgHByt6qbiyWwB3Z9_74vDzLWrrLQID3DU2sNidvSevh7Ktztx6efFEUi2Trt2xc8MVVh5PLhzJOeUYr5KYLrFS2XkLijHANRN5fyYO7CSEihUfeRHVXK89QfpwSym8L5coapKIsRf4HfA/s400/CurveOutput+Menu.png" width="400" /></a></div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-qMaqj0rXLSBRdjixFxvDVHDaqDKJwgQeYJsOMK-Js63Sr_bIllLUN6_4mVDVd15p9DBqi81orsazTFXyJRKprZbvwM0AW0t17Qi3KWbPzk15lLIKmrNQPxrOnSBi9gO2yQs8XXZgwVQ/s1600/CurveOutput+Block.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="177" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-qMaqj0rXLSBRdjixFxvDVHDaqDKJwgQeYJsOMK-Js63Sr_bIllLUN6_4mVDVd15p9DBqi81orsazTFXyJRKprZbvwM0AW0t17Qi3KWbPzk15lLIKmrNQPxrOnSBi9gO2yQs8XXZgwVQ/s200/CurveOutput+Block.png" width="200" /></a></div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhLmyrljadCkbdXTcKnz5D6LMwb-HbItfzyPQn9-Y01mBKil3wae8EV_-ZskMB5p7oYa-c-AjjiQI9yYBdUZ_hEWQTeLxtc0N2oyELWJ2QCU1j4kErURbC65YI-PRwADiGSfZ15zxtzXLg/s1600/CurveOutput+Inspector.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="256" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhLmyrljadCkbdXTcKnz5D6LMwb-HbItfzyPQn9-Y01mBKil3wae8EV_-ZskMB5p7oYa-c-AjjiQI9yYBdUZ_hEWQTeLxtc0N2oyELWJ2QCU1j4kErURbC65YI-PRwADiGSfZ15zxtzXLg/s320/CurveOutput+Inspector.png" width="320" /></a></div>
<div>
<br /></div>
<div>
가감속을 위해서 Curve를 아래 그림과 같이 설정합니다.</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjS0Cu1AwREz05Yh9g2dvafUXCP39wAsi1GQ_RHmeHLBTezHI_ZZ9NBeZuTsAaXwBnt9BjJWuXNgvv17wdHV-Wfmswk0dFYtMORF1064s0nmFolQQpg45-RuxIgU1o49UF-_w7F44Ec8g4/s1600/CurveOutput.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="201" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjS0Cu1AwREz05Yh9g2dvafUXCP39wAsi1GQ_RHmeHLBTezHI_ZZ9NBeZuTsAaXwBnt9BjJWuXNgvv17wdHV-Wfmswk0dFYtMORF1064s0nmFolQQpg45-RuxIgU1o49UF-_w7F44Ec8g4/s400/CurveOutput.png" width="400" /></a></div>
<div>
<br /></div>
<div>
위 그림에서와 같이 모터의 속도는 서서히 증가하고 서서히 감소하도록 제어됩니다.</div>
<div>
그러나, 정회전과 역회전은 서로 다릅니다. 따라서, CurveOutput을 2개를 만들어 정회전용과 역회전용을 만들어야 합니다.</div>
<div>
GenericMotor에는 CurveOutput 2개 중 하나만 연결할 수 있기때문에 난감한 상황이 됩니다. 이때 사용할 수 있는 것이 OutputCombine입니다.</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0FAn4jnxlDOvxPpO_DFMQ-yDBWu_B-5_7vRLAi2ex8Lm-42blD1LmgcoPkCOudKGTt0WEgqIUVyp3TIxQxygxR_HjL96UgNr-cXVYkPLizfFGr7KXleLTjA6vv-JzNcgR88UWsyn4dd4/s1600/OutputCombine+Menu.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="112" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0FAn4jnxlDOvxPpO_DFMQ-yDBWu_B-5_7vRLAi2ex8Lm-42blD1LmgcoPkCOudKGTt0WEgqIUVyp3TIxQxygxR_HjL96UgNr-cXVYkPLizfFGr7KXleLTjA6vv-JzNcgR88UWsyn4dd4/s400/OutputCombine+Menu.png" width="400" /></a></div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEipUweS2Tdy8ppwMH-ElLNxXhewAdmbPm9f-OhzaKqwG6ag470TzHzQugBIgxl3QMhNyd9jFi8WSRY-IjnMIRWeqF-Zk_WS7FnlyMZsArFtMsf1czHfGx-2BDhQY7LkFtI20FfOrb-We7Y/s1600/OutputCombine+Block.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="156" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEipUweS2Tdy8ppwMH-ElLNxXhewAdmbPm9f-OhzaKqwG6ag470TzHzQugBIgxl3QMhNyd9jFi8WSRY-IjnMIRWeqF-Zk_WS7FnlyMZsArFtMsf1czHfGx-2BDhQY7LkFtI20FfOrb-We7Y/s200/OutputCombine+Block.png" width="200" /></a></div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj6l_sBK_Crz7LSZAQW26rIKgPCCNFPmIsfa5E8p_HK0OH4AfX0SpHcJMPBo6gPsiwWmQ-MiseG63s7MqBUkutKl_HKD0KLXS79ZxMSJ1XHSSfgj6tcHVJ0TSXrbZpMhDAF89NI8wMawlw/s1600/OutputCombine+Inspector.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="69" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj6l_sBK_Crz7LSZAQW26rIKgPCCNFPmIsfa5E8p_HK0OH4AfX0SpHcJMPBo6gPsiwWmQ-MiseG63s7MqBUkutKl_HKD0KLXS79ZxMSJ1XHSSfgj6tcHVJ0TSXrbZpMhDAF89NI8wMawlw/s320/OutputCombine+Inspector.png" width="320" /></a></div>
<div>
<br /></div>
<div>
OutputCombine은 서로 다른 2개의 Curve를 합칠 수 있게 해줍니다. 합치는 방법은 CombineMode로 선택할 수 있습니다.</div>
<div>
<ul>
<li>Minimum: 입력된 값 중 가장 작은 것을 출력한다.</li>
<li>Maximum: 입력된 값 중 가장 큰 것을 출력한다.</li>
<li>Average: 입력된 값들의 평균을 출력한다.</li>
<li>Sum: 입력된 값들의 합을 출력한다.</li>
</ul>
<div>
DC 모터의 정회전, 역회전 Curve를 합치기 위해서는 CombineMode를 Sum으로 선택해야 합니다.</div>
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi6dBahZvyOg8vz88EfGTOGTVWkCm7BYWCL5hpdXVqo_NwXRTL0yZqYPkCGv-R9lXlUt6TXVNFbvwuSDsOnZQP8Ci3ARTWLURWHoLQIYZ-INzu_cSPRyXowjJ6pkAdVjb6pb5iEWVr0wBc/s1600/CombineOutput.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="218" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi6dBahZvyOg8vz88EfGTOGTVWkCm7BYWCL5hpdXVqo_NwXRTL0yZqYPkCGv-R9lXlUt6TXVNFbvwuSDsOnZQP8Ci3ARTWLURWHoLQIYZ-INzu_cSPRyXowjJ6pkAdVjb6pb5iEWVr0wBc/s400/CombineOutput.png" width="400" /></a></div>
<div>
<br /></div>
<div>
정회전, 역회전의 가감속 제어를 위한 Curve를 실행시키기 위해서는 Button을 연결하면 됩니다.</div>
<div>
이렇게해서 최종으로 연결된 그림은 다음과 같습니다.</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6KAahAgW7pU8mVmBW30f6VuK0fRI_mReqoXV-BgfEUASgdIuBb7Sai-msn0w_sOQq0CWC40KxDbhoIVfKikigSBqteEDt43QILXbLt0r0Jqs88zp2nclPJhwEDmeZwt0oYMg3SG7P7Gc/s1600/DCMotor+Example3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="186" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6KAahAgW7pU8mVmBW30f6VuK0fRI_mReqoXV-BgfEUASgdIuBb7Sai-msn0w_sOQq0CWC40KxDbhoIVfKikigSBqteEDt43QILXbLt0r0Jqs88zp2nclPJhwEDmeZwt0oYMg3SG7P7Gc/s400/DCMotor+Example3.png" width="400" /></a></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
지금까지의 DC 모터를 다루는 예제를 동영상으로 감상하시기 바랍니다.</div>
<div class="separator" style="clear: both; text-align: center;">
<iframe width="320" height="266" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/xNpbGG70dH4/0.jpg" src="https://www.youtube.com/embed/xNpbGG70dH4?feature=player_embedded" frameborder="0" allowfullscreen></iframe></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
Anonymoushttp://www.blogger.com/profile/10315630713623521810noreply@blogger.com0tag:blogger.com,1999:blog-2144160700871786133.post-72916385222923077542016-09-30T20:55:00.001+09:002016-09-30T20:55:26.161+09:00아두니티 PlayMaker Add-on아두니티는 PlayMaker를 완벽하게 지원합니다.<div>
PlayMaker는 C# 프로그래밍을 배우기 어려워하는 사람들에게 인기가 많은 Visual 프로그래밍 도구입니다.</div>
<div>
아두니티는 전문 기술이 없는 메이커를 주 사용자로 보고있기 때문에 PlayMaker를 이용해서 아두니티를 제어하는 것을 지원하고 있습니다.</div>
<div>
PlayMaker에서 아두니티를 제어하려면 먼저 아두니티 PlayMaker Add-on을 설치해야 합니다.</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgvNN0v1n_yGjC-k4pilklVR0PPoPuCRvsAhAZ_8SgIdcpP54LEwJl_-Brj9t6-QoD1HIfmiY5gN7jXItiw76tQr8acGs91hOq244Nv7-Wn3jUhAn5kTbPZRkPHq1uEytq6lOTCwjdyyk8/s1600/PlayMaker+Addon.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="180" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgvNN0v1n_yGjC-k4pilklVR0PPoPuCRvsAhAZ_8SgIdcpP54LEwJl_-Brj9t6-QoD1HIfmiY5gN7jXItiw76tQr8acGs91hOq244Nv7-Wn3jUhAn5kTbPZRkPHq1uEytq6lOTCwjdyyk8/s200/PlayMaker+Addon.png" width="200" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">PlayMaker Add-on 설치 메뉴</td></tr>
</tbody></table>
<div>
<br /></div>
<div>
<span style="color: red;"><u>아두니티 PlayMaker Add-on을 설치하려면 반드시 PlayMaker가 이미 Import되어야 합니다. 만약, 갖고있지 않은 분들은 먼저 에셋 스토어에서 PlayMaker를 구매해야 합니다.</u></span></div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjD_HxaRlFaInMJTuPgi0rRjMtNL95-iaM3eQO4NlCFYIFzeAoFio33kaaf7ngu0KwD6vNB_rvA8LYklpa3GgXzgnhCDgCMlkJQ4QwP-BF72Frm2yeJiB-NV7ujETS5piEELk3V7anq3CQ/s1600/Import+PlayMaker+Addon.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="290" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjD_HxaRlFaInMJTuPgi0rRjMtNL95-iaM3eQO4NlCFYIFzeAoFio33kaaf7ngu0KwD6vNB_rvA8LYklpa3GgXzgnhCDgCMlkJQ4QwP-BF72Frm2yeJiB-NV7ujETS5piEELk3V7anq3CQ/s320/Import+PlayMaker+Addon.png" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">PlayMaker Add-on이 추가되는 모습</td></tr>
</tbody></table>
<div>
<br /></div>
<div>
PlayMaker Add-on이 설치되고 나면 다음과 같은 것이 생기게 됩니다.</div>
<div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<ul>
<li>에셋 폴더에 PlayMaker가 생긴다.</li>
<li>PlayMaker 관련 기능을 추가할 수 있는 메뉴가 생긴다.</li>
<li>PlayMaker Action Browser에 ARDUnity 카테고리가 생긴다.</li>
</ul>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEghjhSc8wvBUmRHbd9Kqp3cBcBXLqPD90qO0AolH8xQbPjrUuew3bAi34sovAzGNToln2Y4bidBl9MX0tic_pwcnMJoCf7kPPtW0GzXaXWrQBgd7uPEhlpSsv4ucOMUAx7NJYQTTHv5XLY/s1600/PlayMaker+Addon+Folder.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="220" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEghjhSc8wvBUmRHbd9Kqp3cBcBXLqPD90qO0AolH8xQbPjrUuew3bAi34sovAzGNToln2Y4bidBl9MX0tic_pwcnMJoCf7kPPtW0GzXaXWrQBgd7uPEhlpSsv4ucOMUAx7NJYQTTHv5XLY/s320/PlayMaker+Addon+Folder.png" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">ARDUnity Asset 폴더에 PlayMaker가 생긴다.</td></tr>
</tbody></table>
<div>
<br /></div>
</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjrKuLJYbN7GLpudaSV5iT0QU5KYVcyayj7iy4BhGl5F4MjtSfMGIel6mbv84MGimPUV1o3swtT-gYWJRqhwANEe7voW5kEXDjKAVLUBsBneAnuyqiSLb7XAf2tZju056rv-Qljn1qfx-E/s1600/PlayMaker+Menu.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="231" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjrKuLJYbN7GLpudaSV5iT0QU5KYVcyayj7iy4BhGl5F4MjtSfMGIel6mbv84MGimPUV1o3swtT-gYWJRqhwANEe7voW5kEXDjKAVLUBsBneAnuyqiSLb7XAf2tZju056rv-Qljn1qfx-E/s320/PlayMaker+Menu.png" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">PlayMaker 관련 기능을 추가할 수 있다.</td></tr>
</tbody></table>
<div>
<br /></div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgs7Zx-mBWiYwjbBq8ULjEgZfiYfn4ydcVnDuI3BZeewr5BiSo9t9CsVsWCARv5t1HWvWcydhCwFh6-GW0BWmurfSc_TZPaV8hMpd5S3v_N4yXjoNhCdSsV2U83JJA6_62f39DlkMvr2F8/s1600/PlayMaker+Actions.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgs7Zx-mBWiYwjbBq8ULjEgZfiYfn4ydcVnDuI3BZeewr5BiSo9t9CsVsWCARv5t1HWvWcydhCwFh6-GW0BWmurfSc_TZPaV8hMpd5S3v_N4yXjoNhCdSsV2U83JJA6_62f39DlkMvr2F8/s400/PlayMaker+Actions.png" width="181" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">PlayMaker Action에 ARDUnity 카테고리가 생긴다.</td></tr>
</tbody></table>
<div>
<br /></div>
<div>
이렇게 된다면 아두니티에서 PlayMaker를 사용할 수 있는 준비가 끝납니다.</div>
<div>
<u><span style="color: red;">만약, PlayMaker가 없는 상태에서 PlayMaker Add-on을 설치했다면 에러가 발생하게 되는데, 이를 해결하려면 ARDUnity/PlayMaker 폴더를 삭제하면 됩니다.</span></u></div>
<div>
<br /></div>
<div>
PlayMaker Action은 FSM Logic내에서 기능을 수행하기 위해 사용합니다. 만약, FSM Logic내에서 아두니티를 제어하려면 ARDUnity Action을 사용하면 됩니다.</div>
<div>
<br /></div>
<div>
PlayMaker에서 Event는 Transition을 발생시키기 위해 사용합니다.</div>
<div>
PlayMaker Action이 출력을 위해 사용된다면 Event는 입력을 위해 사용된다고 생각할 수 있습니다.</div>
<div>
그렇다면 아두이노 보드에서 일어나는 일을 PlayMaker Event로 받기 위해서는 어떻게 해야 할까요?</div>
<div>
PlayMaker Editor에서 Event를 만들수는 있지만, Event를 발생시킬 수는 없습니다. 이 말은 PlayMaker Event를 발생시킬 수 있는 무언가가 필요하다는 뜻입니다.</div>
<div>
<br /></div>
<div>
아두니티에서 일어나는 일을 PlayMaker에 알려줄 수 있는 Event를 발생시키는 컴포넌트가 바로 Proxy입니다. Proxy란 말은 어떤 것을 감시하여 알려준다는 의미를 갖고 있습니다.</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjrKuLJYbN7GLpudaSV5iT0QU5KYVcyayj7iy4BhGl5F4MjtSfMGIel6mbv84MGimPUV1o3swtT-gYWJRqhwANEe7voW5kEXDjKAVLUBsBneAnuyqiSLb7XAf2tZju056rv-Qljn1qfx-E/s1600/PlayMaker+Menu.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="231" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjrKuLJYbN7GLpudaSV5iT0QU5KYVcyayj7iy4BhGl5F4MjtSfMGIel6mbv84MGimPUV1o3swtT-gYWJRqhwANEe7voW5kEXDjKAVLUBsBneAnuyqiSLb7XAf2tZju056rv-Qljn1qfx-E/s320/PlayMaker+Menu.png" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">ARDUnity Proxy 추가 메뉴</td></tr>
</tbody></table>
<div>
<br /></div>
<div>
각 Proxy들은 감시 대상이 필요한데, 모든 대상이 아닌 특정 대상만 감시하게 됩니다.</div>
<div>
예를 들어 DigitalInputProxy는 DigitalInput의 이름을 가진 ARDUnity 컴포넌트를 감시한다는 것입니다.</div>
<div>
아두이노 회로에서 버튼이 눌리면 PlayMaker Event가 발생하는 예제를 직접 만들면서 Proxy 사용법을 알려드리겠습니다.</div>
<div>
먼저, 버튼 제어에 사용되는 DigitalInput을 찾아 GameObject를 선택합니다. 이때 Proxy 추가 메뉴를 보면 DigitalInputProxy가 활성화된 것을 볼 수 있습니다.</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjB_-sQxEH-LEgbHzobhXYGEdjzimQ-OhP_87Aw-jFpsIORkd4ZMhMTPG98HwFuJH-LiDrn9X3deofizBkyMfYd74WP1v3YO54snhbEL7owSqyuWItiDBmM3OEnrERgT7eWFhaqAvziqOg/s1600/DigitalInputProxy+Menu.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="241" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjB_-sQxEH-LEgbHzobhXYGEdjzimQ-OhP_87Aw-jFpsIORkd4ZMhMTPG98HwFuJH-LiDrn9X3deofizBkyMfYd74WP1v3YO54snhbEL7owSqyuWItiDBmM3OEnrERgT7eWFhaqAvziqOg/s320/DigitalInputProxy+Menu.png" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Proxy를 추가하려면 먼저 감시할 대상이 추가되어 있어야 한다.</td></tr>
</tbody></table>
<div>
<br /></div>
<div>
DigitalInputProxy를 추가하면 Inspector Window에 컴포넌트가 추가된 것을 볼 수 있습니다.</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEji1mjZvOt6JiUydSJ8zXeFHgpVcET68Vb7su1OKV7qq8TeabLen-HxxBcPmCJrw8O3EpmEXGEzBM1spdKOb26EkeZTdaJIaVj30Gr5TylVKJ1OjGiWm8RCvnGTnH4fljky0DPep8lNqTw/s1600/DigitalInputProxy+Inspector.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="293" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEji1mjZvOt6JiUydSJ8zXeFHgpVcET68Vb7su1OKV7qq8TeabLen-HxxBcPmCJrw8O3EpmEXGEzBM1spdKOb26EkeZTdaJIaVj30Gr5TylVKJ1OjGiWm8RCvnGTnH4fljky0DPep8lNqTw/s320/DigitalInputProxy+Inspector.png" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Proxy가 추가된 모습</td></tr>
</tbody></table>
<div>
<br /></div>
<div>
만약, Proxy의 감시 대상이 없어진다면 에러가 표시되고 더 이상 Proxy역할을 할 수 없게 됩니다.</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjvy_sng5In29YTq_P0Ye5Apg2eFtWp95vaY3O77gFCCA8m3zOisUTx8dhTIoWmtq32MvwT-dD7iazm2yjbnmgpTf_GAJX1aRn7AW2Q8aX_y74pS3wUE0tY4-zsR7sJqFJS4_BEIK1scns/s1600/DigitalInputProxy+Inspector2.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="81" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjvy_sng5In29YTq_P0Ye5Apg2eFtWp95vaY3O77gFCCA8m3zOisUTx8dhTIoWmtq32MvwT-dD7iazm2yjbnmgpTf_GAJX1aRn7AW2Q8aX_y74pS3wUE0tY4-zsR7sJqFJS4_BEIK1scns/s320/DigitalInputProxy+Inspector2.png" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Proxy는 감시 대상이 없다면 에러가 출력된다.</td></tr>
</tbody></table>
<div>
<br /></div>
<div>
Proxy의 역할을 대상을 감시하고 PlayMaker Event를 발생시키는 만큼 EventTarget 설정이 필요합니다. EventTarget이란 발생시킬 Event를 갖고 있는 PlayMaker FSM을 의미합니다.</div>
<div>
만약, EventTarget이 지정되지 않는다면 Proxy는 Scene내의 모든 FSM에서 Event를 발생시키게 됩니다.</div>
<div>
특정 FSM에서만 Event를 발생시키려면 해당되는 FSM이 포함된 GameObject를 지정해야 합니다.</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiyBUefrruPpx044ZdloN6pFyjAfAOqfJVqzgWLa7gUn6mKHvFveV_h6lyuU391cj4btamElGPItVfhQ3ZRY5femgnqSRDmtOEFj0mTi-TM6k7mzYhY3qFqfhogIN0FHPGiZB_kVqKwzBM/s1600/Proxy+EventTarget.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="156" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiyBUefrruPpx044ZdloN6pFyjAfAOqfJVqzgWLa7gUn6mKHvFveV_h6lyuU391cj4btamElGPItVfhQ3ZRY5femgnqSRDmtOEFj0mTi-TM6k7mzYhY3qFqfhogIN0FHPGiZB_kVqKwzBM/s320/Proxy+EventTarget.png" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Proxy에서 EventTarget을 지정할 수 있다.</td></tr>
</tbody></table>
<div>
<br /></div>
<div>
먼저, FSM이 포함된 GameObject가 선택되었다면 그 GameObject에 속해있는 FSM 리스트 중에서 다시 선택할 수 있습니다.</div>
<div>
"Included All FSM"의 의미는 선택한 GameObject내에 있는 모든 FSM에서 Event가 발생한다는 뜻입니다.</div>
<div>
<br /></div>
<div>
EventTarget이 설정되었다면, 다음으로는 Event 이름을 정해야 합니다.</div>
<div>
각 Proxy에는 발생시킬 수 있는 Event가 이미 정해져있으며 기본 이름 값을 가지고 있습니다. 같은 Proxy를 여러 개 사용하는 경우 Event 이름이 중복될 수 있으므로 Event 이름을 바꿀 수 있습니다.</div>
<div>
Proxy에 있는 Event 이름은 설정한 EventTarget에 그대로 전달됩니다.</div>
<div>
하지만, 정작 Event를 받는 FSM은 그 이름을 알지 못하기 때문에 반드시 Proxy에 있는 Event 이름을 추가해줘야 합니다.</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjUtdBnI6jPgwivX6BtXqkGIUFD3q-VgqCOY_Lu_cP_T0emFdAKj1k4jFuUfpjHqYiURhrjlKaVLkOsFiL69a3VrCp-3LGw11PyTiTMtpeklW8qYj1PzHbqzwFu4bKTvrm27u6pnY0x3Ik/s1600/FSM+Event.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="281" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjUtdBnI6jPgwivX6BtXqkGIUFD3q-VgqCOY_Lu_cP_T0emFdAKj1k4jFuUfpjHqYiURhrjlKaVLkOsFiL69a3VrCp-3LGw11PyTiTMtpeklW8qYj1PzHbqzwFu4bKTvrm27u6pnY0x3Ik/s400/FSM+Event.png" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Proxy의 Event이름과 FSM의 Event이름은 같아야 한다.</td></tr>
</tbody></table>
<div>
</div>
<div>
이렇게 Event가 추가되면 Transition을 사용할 수 있도록 메뉴가 생기게 됩니다.</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiu4-BZmUH8FJz4lfcLDPIq5_bVhSixDY-aRYok2S2IO5VyXtrIoKyVxM9apaS3w4Q7sb73NvIi9ORJxX7xUNa0qdpAHVRUD4F62mgVHjy6yMtvkzRErMnVPl25ZsZFc5MNjI8sYbg5hbo/s1600/FSM+Transition+Menu.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="191" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiu4-BZmUH8FJz4lfcLDPIq5_bVhSixDY-aRYok2S2IO5VyXtrIoKyVxM9apaS3w4Q7sb73NvIi9ORJxX7xUNa0qdpAHVRUD4F62mgVHjy6yMtvkzRErMnVPl25ZsZFc5MNjI8sYbg5hbo/s400/FSM+Transition+Menu.png" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">추가한 Event가 Transition에 메뉴로 나타난다.</td></tr>
</tbody></table>
<div>
<br /></div>
<div>
이로써 FSM에 Proxy가 사용하는 Event에 반응할 수 있는 Transition이 만들어집니다.</div>
<div>
이렇게되면 아두이노 버튼이 눌리면 -> DigitalInput의 값이 변경되고 -> DigitalInputProxy가 이를 감지하여 Event를 FSM에 보내고 -> FSM에서는 발생한 Event를 사용하는 Transition이 일어나서 반응하게 되는 것입니다.</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhI7ho51LYhrpcunH56R6xiFTOj3L9WAhhyphenhyphen8zk6inIlPJwyNqpBACwYOJTUoj_dy_o4Zdw4waHtBE3b_B5r1acUUG8bvWHAyb1yPEcnic0dMRdYt52SQ336TYenBleKPXjdZAQDtIyADUM/s1600/Proxy+FSM+Example.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="202" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhI7ho51LYhrpcunH56R6xiFTOj3L9WAhhyphenhyphen8zk6inIlPJwyNqpBACwYOJTUoj_dy_o4Zdw4waHtBE3b_B5r1acUUG8bvWHAyb1yPEcnic0dMRdYt52SQ336TYenBleKPXjdZAQDtIyADUM/s400/Proxy+FSM+Example.png" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">하드웨어 반응에 따른 동작을 쉽게 구현할 수 있다.</td></tr>
</tbody></table>
<div>
<br /></div>
<div>
향후, 실제 예제를 통해 아두니티에서 PlayMaker를 활용하는 방법을 보여드리도록 하겠습니다.</div>
<div>
<br /></div>
<div>
<br /></div>
Anonymoushttp://www.blogger.com/profile/10315630713623521810noreply@blogger.com0tag:blogger.com,1999:blog-2144160700871786133.post-64462750935596113222016-09-30T00:07:00.002+09:002016-10-17T16:02:50.346+09:00유니티 안드로이드 빌드이번 포스트에서는 유니티에서 안드로이드 앱을 빌드하는 과정을 자세히 다루겠습니다.<br />
유니티에서 안드로이드 앱을 만들고 싶다면 제일 먼저 해야 할일은 Android Studio를 설치하는 것입니다.<br />
(<a href="https://developer.android.com/studio/index.html" target="_blank">구글 Android Studio 다운로드 바로가기</a>)<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://blogldc.s3.amazonaws.com/wp-content/uploads/2014/12/studio-hero.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://blogldc.s3.amazonaws.com/wp-content/uploads/2014/12/studio-hero.jpg" height="210" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Android Studio는 안드로이드 앱을 개발하는 도구이다.</td></tr>
</tbody></table>
<br />
Android Studio를 설치하다보면 Java SDK를 설치해야 한다는 안내가 나옵니다. 반드시 필요한 것이니 설치하기 바랍니다.<br />
Java SDK를 설치하기 위해 오라클 사이트로 가면 당황스럽게 되는데, 그 이유는 Java SDK라는 말이 안보이기때문에 뭘 설치해야 할 지 막막해집니다.<br />
Java SE 혹은 JDK라고 부르는 것이 그것이니 자신의 OS에 맞는 것을 선택하여 최신 버전을 설치하시면 됩니다.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://i2.wp.com/www.learn2free.com/wp-content/uploads/2016/03/Java-Development-Kit-JDK-Tutorial-in-Urdu.jpg?resize=660%2C330" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://i2.wp.com/www.learn2free.com/wp-content/uploads/2016/03/Java-Development-Kit-JDK-Tutorial-in-Urdu.jpg?resize=660%2C330" height="160" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Android Studio를 설치하기 위해서는 Java SDK 설치가 필요하다.</td></tr>
</tbody></table>
<br />
여기서 잠깐 SDK라는 것에 대해서 설명하겠습니다. SDK는 Software Development Kit의 약자로 쉽게 말해서 소프트웨어를 보다 쉽게 만들 수 있게 만들어주는 프로그램 재료입니다.<br />
안드로이드는 Java를 기반으로 만들었기 때문에 Java SDK가 필요한 것이며 안드로이드 앱을 만들기 위해서는 Android SDK가 필요한데, Android Studio에 포함되어 있습니다.<br />
<br />
Android Studio와 Java SDK 설치가 완료되었다면 유니티에게 이것을 알려줘야 합니다.<br />
유니티 메뉴에서 Preference를 선택하고, External Tool 탭을 선택하면 이것을 설정할 수 있습니다.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://unity3d.com/sites/default/files/build_to_android_7.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="268" src="https://unity3d.com/sites/default/files/build_to_android_7.png" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">SDK는 Android SDK 경로를 의미한다.<br />
JDK는 Java SDK 경로를 의미한다.</td></tr>
</tbody></table>
<br />
JDK 경로 설정은 자동으로 잡히기 때문에 문제가 없지만, Android SDK 경로는 찾을 수가 없어서 당황할 것입니다.<br />
Android SDK 경로를 알기 위해서는 Android Studio를 실행하고 SDK Manager를 선택해야 합니다.<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi1WnpB20eA0q2h69eFyY1_ILk314NZZAnrt7rnPJum9lW76SDCYjFb_HyisoSnsqvkYAK75K98ycBb8d2L4RogYUp0oujTAF41xME5e0XiM2YP3eQZTeCTHjdorUBFHmLkvM8g64HOJYQ/s1600/Android+Studio+Menu.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="265" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi1WnpB20eA0q2h69eFyY1_ILk314NZZAnrt7rnPJum9lW76SDCYjFb_HyisoSnsqvkYAK75K98ycBb8d2L4RogYUp0oujTAF41xME5e0XiM2YP3eQZTeCTHjdorUBFHmLkvM8g64HOJYQ/s320/Android+Studio+Menu.png" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><span style="font-size: 12.8px;">Android Studio 시작화면에서 Configure를 선택한다.</span></td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjvbV5f2ofhcvILXTekobD1ZbEBlu46mTyftjGqgRgl3BU66WTN7D_AJtbcf5C0bqIW8vdulJAtTGbPgJIsg2j87LkfnnG1mB72h_mheqo6r87Kb33l_V62HTnKdVL7s4l1l_O0b4yhrNE/s1600/Android+SDK+Manager.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="232" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjvbV5f2ofhcvILXTekobD1ZbEBlu46mTyftjGqgRgl3BU66WTN7D_AJtbcf5C0bqIW8vdulJAtTGbPgJIsg2j87LkfnnG1mB72h_mheqo6r87Kb33l_V62HTnKdVL7s4l1l_O0b4yhrNE/s320/Android+SDK+Manager.png" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">SDK Manager 메뉴를 찾을 수 있다.</td></tr>
</tbody></table>
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
SDK Manager를 실행하면 SDK 경로를 알 수 있으니 이것을 Copy하여 유니티에서 설정하면 됩니다.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://techathlon.com/wp-content/uploads/2013/07/2013-07-10-18_11_51-Android-SDK-Manager.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://techathlon.com/wp-content/uploads/2013/07/2013-07-10-18_11_51-Android-SDK-Manager.png" height="228" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">SDK Manager에서 SDK Path를 찾을 수 있다.</td></tr>
</tbody></table>
<br />
여기까지 했다면, 유니티에서 안드로이드 앱을 만들기 위한 준비는 끝난 것입니다.<br />
이제 실제로 안드로이드 앱을 만드는 과정을 설명하겠습니다.<br />
우선, 유니티 Build Setting 메뉴를 이용해서 현재 플랫폼을 안드로이드로 변경합니다.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://developer3.oculus.com/images/documentation/game-engines/latest/capt-unity-configbuild.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="320" src="https://developer3.oculus.com/images/documentation/game-engines/latest/capt-unity-configbuild.png" width="294" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">현재 플랫폼을 안드로이드로 변경합니다.</td></tr>
</tbody></table>
<br />
Build 버튼을 누르기 전에 몇 가지 설정해야 할 것이 있으므로 Player Settings를 선택하고 Inspector 윈도우에 나타난 메뉴를 봅니다.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://www.cg.com.tw/unity/pic/Android/Unity43_Android_PublishingSetting_01.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://www.cg.com.tw/unity/pic/Android/Unity43_Android_PublishingSetting_01.jpg" height="320" width="290" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Player Setting에서 안드로이드 앱을 위한 설정을 해야 한다.</td></tr>
</tbody></table>
<br />
<b>스마트 폰의 화면 방향 설정</b><br />
안드로이드 앱이 어떤 화면에서 실행할 지 결정해야 합니다. 유니티는 화면 자동 회전을 지원합니다.<br />
<ul>
<li>Portrait: 세로 방향 보기</li>
<li>Landscape: 가로 방향 보기</li>
</ul>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://matthewjamestaylor.com/img/illustrations/large/ipad-layout-with-landscape-portrait-modes.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://matthewjamestaylor.com/img/illustrations/large/ipad-layout-with-landscape-portrait-modes.jpg" height="115" width="400" /></a></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<b>앱의 고유 식별자 설정</b></div>
<div>
안드로이드 앱에는 앱을 구별할 수 있도록 고유한 식별자가 있습니다. 여러분의 앱도 이것이 필요하므로 설정해야 합니다.</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://www.mat-d.com/site/wp-content/uploads/unity_bundle_identifier-e1335612468382.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://www.mat-d.com/site/wp-content/uploads/unity_bundle_identifier-e1335612468382.png" height="320" width="312" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">안드로이드 앱의 고유 식별자 정보</td></tr>
</tbody></table>
<div>
<br /></div>
<div>
Bundle Identifier가 그것이며 이것을 설정하기 위해서는 반드시 다음 규칙을 지켜야 합니다.</div>
<div>
<ul>
<li>com.[회사명].[프로그램 명]</li>
<li>예를 들어 ABC회사의 CDE 프로그램이라면 com.ABC.CDE라 쓰면 됩니다.</li>
<li>대소문자를 구분하며 제일 앞의 com.은 절대로 변경하면 안됩니다.</li>
</ul>
<div>
Bundle Version은 버전을 표기하기 위함이고 Bundle Version Code는 향후 앱 업그레이드를 위한 것이니 현재는 모두 1.0과 1로 설정하면 됩니다.</div>
</div>
<div>
<br /></div>
<div>
<b>Android SDK 버전</b></div>
<div>
여러분은 안드로이드 아이스크림, 젤리빈 등의 명칭을 들어본 적이 있을 것입니다. 이것은 안드로이드 버전을 의미하며 특이하게도 안드로이드는 주요 버전을 알파벳으로 표기하고 각 알파벳으로 시작하는 명사로 이름을 붙였습니다.</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://www.oneclickroot.com/wp-content/uploads/2014/06/Android-Versions-History.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="200" src="https://www.oneclickroot.com/wp-content/uploads/2014/06/Android-Versions-History.jpg" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">안드로이드는 버전별로 알파벳을 붙인다.</td></tr>
</tbody></table>
<div>
<br /></div>
<div>
안드로이드 앱을 만들기 위해서는 이 앱이 실행하기 위한 버전을 명시해줘야 합니다. 안드로이드 각 버전은 하위 호환성을 가지기때문에 최소 버전만 설정하면 상위 버전에서는 호환이 됩니다.</div>
<div>
유니티에서는 Minimum API Level이란 이름으로 실행할 수 있는 최소 버전을 설정하게 됩니다.</div>
<div>
하지만, 여러분이 주의해야 할 점은 Android Studio에도 앱이 실행할 안드로이드 버전의 SDK가 반드시 있어야 한다는 것입니다.</div>
<div>
즉, 안드로이드 4.0을 최소 버전으로 한다면 Android Studio에는 SDK 4.0부터 최신 버전까지 설치되어 있어야 한다는 것입니다.</div>
<div>
이것을 확인하려면 다시 Android Studio를 실행하고 SDK Manager를 실행해야 합니다.</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://dab1nmslvvntp.cloudfront.net/wp-content/uploads/2012/03/figure2.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="229" src="https://dab1nmslvvntp.cloudfront.net/wp-content/uploads/2012/03/figure2.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">SDK Manager에서 SDK를 버전 별로 설치할 수 있다.</td></tr>
</tbody></table>
<div>
<br /></div>
<div>
만든 앱을 실행할 기기에서 안드로이드 버전을 확인하여 적절한 SDK 버전을 확보해야 합니다.</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEibdlgUovyw5YivmaXhyQqWIyyzLFBvMzmWjmDjaViBaJrWBMi9w-eREAS5paLZT-VFIt_SNtrA2InK0UPsdluExz9V8oAuKmbts0u4hNY9-d4W4FI1BPg4vybnmdsy2WM3JCAfL0PiLd4/s1600/Smartphone+Device+Info.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEibdlgUovyw5YivmaXhyQqWIyyzLFBvMzmWjmDjaViBaJrWBMi9w-eREAS5paLZT-VFIt_SNtrA2InK0UPsdluExz9V8oAuKmbts0u4hNY9-d4W4FI1BPg4vybnmdsy2WM3JCAfL0PiLd4/s320/Smartphone+Device+Info.png" width="206" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><span style="font-size: 12.8px;">핸드폰에서 안드로이드 버전을 확인할 수 있다.</span></td></tr>
</tbody></table>
<br /></div>
<div>
위에서 언급한 설정을 모두 마쳤다면 이제 앱을 만들 수 있습니다.</div>
<div>
유니티 Build Setting에서 Build 버튼을 누르면 만들어진 앱 설치 파일(APK 파일)을 저장할 경로를 선택하게 되고 유니티는 설치 파일을 만들기 시작합니다.</div>
<div>
(<span style="color: red;"><u>Build 결과물 저장 시 절대로 Assets 폴더 안에 만들 지 않아야 합니다.</u></span>)</div>
<div>
빌드가 성공적으로 수행된다면 APK파일이 만들어집니다. APK파일은 안드로이드 앱 설치 파일로써 안드로이드 기기에 이 파일을 옮겨서 실행하면 앱이 설치되게 됩니다.</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://dt.azadicdn.com/wp-content/uploads/2014/08/APK-file-sample.png?5006" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="190" src="https://dt.azadicdn.com/wp-content/uploads/2014/08/APK-file-sample.png?5006" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">확장자가 apk인 파일은 안드로이드 앱 설치 파일이다.</td></tr>
</tbody></table>
<div>
<br /></div>
<div>
핸드폰에 APK파일을 옮기는 방법은 여러가지가 있겠지만, 가장 일반적인 것은 데이터 케이블을 연결하여 파일을 복사하는 것입니다.</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://www.dreamcode.co.kr/Content/Images/yiYXjmutDksscomn/7.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://www.dreamcode.co.kr/Content/Images/yiYXjmutDksscomn/7.png" height="237" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">APK파일을 옮기기 위해 PC와 연결한다.</td></tr>
</tbody></table>
<div>
<br /></div>
<div>
현재는 테스트이기 때문에 이와 같은 방법으로 안드로이드 기기에 APK파일을 옮기지만, 향후 구글 Play Store에 올린다면 온라인을 통해 설치할 수 있습니다.</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://techbakbak.com/wp-content/uploads/2016/07/8-new-categories-in-Google-Play-Store.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://techbakbak.com/wp-content/uploads/2016/07/8-new-categories-in-Google-Play-Store.jpg" height="180" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">구글 플레이 스토어</td></tr>
</tbody></table>
<div>
<br /></div>
<div>
스마트 폰으로 옮긴 APK파일은 스마트 폰의 파일 탐색기를 통해 찾을 수 있으며, 실행하면 앱이 설치됩니다.</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://careace.net/wp-content/uploads/2011/09/my-files-application.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://careace.net/wp-content/uploads/2011/09/my-files-application.png" height="261" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">옮긴 APK파일은 안드로이드에서 탐색기를 통해 찾을 수 있다.</td></tr>
</tbody></table>
<div>
<br /></div>
<div>
APK파일을 실행하면 아마 대부분은 출처를 알 수 없는 앱이라는 경고가 나올 것입니다. 안드로이드는 보안을 이유로 APK파일을 수동으로 설치하는 것을 막아놓았습니다. 따라서, 여러분은 테스트를 위해 이 옵션을 꺼 놓아야 합니다.</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhkFhEWchNBkJ0cM5V7eshz8yRVbdG0dtN18-qxgDyPT4UXasP7REvGY8URrwOP3R33q1Oy-_c4MteWs8LMHpNsJiQsgCUKB_RGKihO6JkdPZ-igHXN9vJWPEcaAhfiJCaz_TTv77vtn2E/s1600/APK+Install+Error.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhkFhEWchNBkJ0cM5V7eshz8yRVbdG0dtN18-qxgDyPT4UXasP7REvGY8URrwOP3R33q1Oy-_c4MteWs8LMHpNsJiQsgCUKB_RGKihO6JkdPZ-igHXN9vJWPEcaAhfiJCaz_TTv77vtn2E/s320/APK+Install+Error.png" width="206" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><span style="font-size: 12.8px;">APK 수동 설치시 경고 메시지가 출력된다.</span></td></tr>
</tbody></table>
<br /></div>
<div>
문제 없이 설치되었다면 유니티 마크의 앱 아이콘을 확인할 수 있고, 이것을 실행하면 여러분이 Build Setting에서 포함시킨 Scene이 나타납니다.</div>
<div>
(앱 아이콘은 Player Setting에서 바꿀 수 있습니다.)</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://i.stack.imgur.com/DZeBT.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://i.stack.imgur.com/DZeBT.png" height="202" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Unity 시작 화면과 함께 만든 앱이 실행됩니다.</td></tr>
</tbody></table>
<div>
<br /></div>
<div>
아두니티용 안드로이드 앱은 블루투스 통신을 사용해야 하므로 몇 가지 설정해야 할 것이 있으며 이것에 대해 나중에 다루겠습니다.</div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
Anonymoushttp://www.blogger.com/profile/10315630713623521810noreply@blogger.com0tag:blogger.com,1999:blog-2144160700871786133.post-19738419406463912392016-09-19T14:05:00.003+09:002016-09-19T14:05:59.131+09:00유니티 UI유니티 UI는 GUI(Graphic User Interface)를 만들기 위한 특별한 기능입니다.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://forum.unity3d.com/attachments/guipic-png.102090/" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://forum.unity3d.com/attachments/guipic-png.102090/" height="200" width="400" /></a></div>
<br />
GUI란 사용자가 App을 조작하기 위한 메뉴를 의미합니다. 원래 UI(User Interface)는 전자 장치를 조작하기 위한 다양한 기능에서 출발했습니다.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://upload.wikimedia.org/wikipedia/commons/5/53/Braun_T1000CD_Closeup.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="240" src="https://upload.wikimedia.org/wikipedia/commons/5/53/Braun_T1000CD_Closeup.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">하드웨어 UI의 예</td></tr>
</tbody></table>
<br />
GUI란 말은 원래 컴퓨터를 일반인들도 쉽게 다룰 수 있도록 만들기 위해 노력한 스티브 잡스가 고안한 개념입니다. 하드웨어 UI를 화면에 그래픽으로 표현함으로써 컴퓨터를 마치 기존의 전자 장치처럼 쓸 수 있도록 만드는 것이 GUI의 목표였습니다.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://i.ytimg.com/vi/zB-gAi7F54w/maxresdefault.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="186" src="https://i.ytimg.com/vi/zB-gAi7F54w/maxresdefault.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">GUI의 디자인은 하드웨어 UI와 유사하다.</td></tr>
</tbody></table>
<br />
GUI는 점차 하드웨어로는 표현할 수 없는 다양한 조작 방식을 보여주며 독자적으로 발전되어 왔습니다.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://inspirationhut.net/wp-content/uploads/2013/08/23.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="260" src="https://inspirationhut.net/wp-content/uploads/2013/08/23.png" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">GUI는 점차 발전되고 있습니다.</td></tr>
</tbody></table>
<br />
이제 소프트웨어 개발에 있어서 사용자 조작을 위한 GUI는 빠질 수 없는 개념이기에 유니티에서도 GUI 개발을 위한 기능을 제공하며 이것을 유니티 UI 혹은 UGUI라 부릅니다.<br />
<br />
유니티에서 UI를 만들기 위해서는 Canvas라 부르는 특별한 컴포넌트를 사용해야 합니다. Canvas는 UI가 보여질 화면을 뜻하며, 이곳에 다양한 GUI 요소를 올려놓음으로써 디자인 할 수 있습니다.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://i.ytimg.com/vi/8SG67Dgy8GY/maxresdefault.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="180" src="https://i.ytimg.com/vi/8SG67Dgy8GY/maxresdefault.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">유니티 UI 디자인 모습</td></tr>
</tbody></table>
<br />
UI는 2D이므로 Scene에서 2D 모드로 설정하고 편집하는 것이 좋습니다.<br />
Canvas는 다음과 같은 기능을 지원합니다.<br />
<br />
<b>오버레이(Overlay) 방식 지원</b><br />
GUI는 사용자를 위한 조작 메뉴이므로 항상 제일 앞에 놓여져야 합니다. 오버레이는 UI가 다른 어떤 것보다도 우선적으로 위에 놓여지게 하는 방식을 의미합니다.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQsI2osM_d7WWytlZ_4vGL2c62fvdHtAr7uczF7cWO-f99Jv86CKg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="179" src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQsI2osM_d7WWytlZ_4vGL2c62fvdHtAr7uczF7cWO-f99Jv86CKg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">GUI는 언제든 조작이 가능하도록 앞에 있어야 한다.</td></tr>
</tbody></table>
<br />
<b>다양한 화면 크기에 대응</b><br />
소프트웨어가 보이는 화면은 기기마다 다릅니다. 그 화면의 크기는 해상도가 될 수도 있고, 실제 디스플레이 장치의 크기가 될 수도 있습니다.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://skyje.com/wp-content/uploads/2013/03/Responsive-Website-Design.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://skyje.com/wp-content/uploads/2013/03/Responsive-Website-Design.jpg" height="187" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">기기마다 화면의 크기는 다르다.</td></tr>
</tbody></table>
<br />
이 기능은 하나의 GUI 디자인으로 여러 기기의 화면에 대응하여 사용자에게 항상 같은 UI를 보여주는데 유리합니다.<br />
<br />
<b>3D GUI</b><br />
유니티는 3D 디자인 도구이므로 당연히 GUI도 3D로 보여주는 것이 가능합니다.<br />
3D GUI는 2가지 방식을 생각할 수 있는데, 첫번째는 회전에 의해 비스듬하게 보여지는 것입니다.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://www.gekodesign.com/web/m3/others/06_p1gui/web_03/04a.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://www.gekodesign.com/web/m3/others/06_p1gui/web_03/04a.jpg" height="181" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">이제 GUI는 평면이 아닌 3D 공간으로 표현된다.</td></tr>
</tbody></table>
<br />
다음 방식으로는 3D 물체에 부착되어 사용자가 공간속에서 GUI를 보게되는 것입니다.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://zdjecia.pl.sftcdn.net/pl/scrn/45000/45900/3dna-desktop-8.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://zdjecia.pl.sftcdn.net/pl/scrn/45000/45900/3dna-desktop-8.jpg" height="240" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">사용자가 공간을 돌아다니며 GUI를 조작할 수 있다.</td></tr>
</tbody></table>
<br />
<br />
유니티 UI에서 기본으로 제공하는 GUI요소는 다음과 같습니다.<br />
<b><br /></b>
<b>Label</b><br />
라벨은 텍스트를 표현하는 기본적인 GUI 중 하나입니다.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://i.ytimg.com/vi/jMCL6zMj1SQ/maxresdefault.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="200" src="https://i.ytimg.com/vi/jMCL6zMj1SQ/maxresdefault.jpg" width="320" /></a></div>
<br />
텍스트의 다양한 효과를 위해 폰트 지정, 글자 크기, 글자 색, 볼드/이탤릭 체 등의 기능을 지원하고 배치와 관련된 왼쪽/가운데/오른쪽 정렬 등도 가능합니다.<br />
<br />
<b>Image</b><br />
GUI에서 아이콘과 같은 이미지를 보여주는 것은 기본적인 기능입니다.<br />
PNG포맷 이미지를 이용해서 투명 배경을 사용하면 매우 깔끔하게 이미지를 보여줄 수 있습니다. 이미지에 색상을 입힐 수 있기 때문에 흑백 이미지를 사용한다면 하나의 이미지로 여러 이미지 효과를 줄 수 있습니다.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://payload101.cargocollective.com/1/9/298260/4323269/Fantasy_Conflict_iOS_Game.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://payload101.cargocollective.com/1/9/298260/4323269/Fantasy_Conflict_iOS_Game.png" height="320" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">이미지를 이용하면 GUI를 멋있게 표현할 수 있다.</td></tr>
</tbody></table>
<br />
<b>Button</b><br />
버튼은 사용자가 조작할 수 있는 기본적인 GUI중 하나입니다.<br />
이것은 Label과 Image를 조합하여 사용하기 때문에 이미지를 바꾸거나 폰트를 이용해서 다양한 디자인을 표현할 수 있습니다.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcRRylHiCCXMpzrcUornREgxlNsmmNEU9RmQzISZPEc_ahrc0rfjwg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="174" src="https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcRRylHiCCXMpzrcUornREgxlNsmmNEU9RmQzISZPEc_ahrc0rfjwg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">GUI 버튼의 예</td></tr>
</tbody></table>
<br />
<b>Toggle</b><br />
토글은 On/Off 상태를 전환할 수 있는 GUI입니다.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://i-msdn.sec.s-msft.com/en-us/windows/uwp/controls-and-patterns/images/checkbox3.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="200" src="https://i-msdn.sec.s-msft.com/en-us/windows/uwp/controls-and-patterns/images/checkbox3.png" width="148" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">토글방식 GUI의 예</td></tr>
</tbody></table>
<br />
<b>Slider</b><br />
슬라이더는 값의 크기를 조절하는데 많이 사용되는 GUI입니다. 오디오 볼륨을 조절할 때 슬라이더 GUI가 주로 사용됩니다.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://www.tasharen.com/ngui/uislider.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://www.tasharen.com/ngui/uislider.jpg" height="129" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">슬라이더 방식 GUI</td></tr>
</tbody></table>
<br />
슬라이더 GUI는 조금만 응용하면 다양한 모양으로 표현할 수 있습니다.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://media02.hongkiat.com/beautiful-volume-dials-knobs/9-33-beautiful-volume-dials.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://media02.hongkiat.com/beautiful-volume-dials-knobs/9-33-beautiful-volume-dials.jpg" height="192" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">슬라이더 GUI는 다이얼 형태로 표현할 수 있다.</td></tr>
</tbody></table>
<br />
<b>Dropdown</b><br />
드롭다운 GUI는 옵션을 설정할 때 많이 사용합니다. 적은 공간에 여러 정보를 표현할 수 있다는 장점이 있습니다.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://docs.unity3d.com/uploads/Main/UI_DropdownExampleOpen.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="192" src="https://docs.unity3d.com/uploads/Main/UI_DropdownExampleOpen.png" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">드롭다운 GUI</td></tr>
</tbody></table>
<br />
이 외에도 다양한 GUI 요소를 유니티 UI를 이용해서 표현할 수 있습니다. 다만, 기본으로 제공하는 것이 아니기에 조합을 통해 응용하거나 에셋 스토어에서 만들어놓은 것을 사용하면 더 훌륭한 디자인의 GUI를 표현할 수 있습니다.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://images.naldzgraphics.net/2015/08/15-apple-watch-gui-sketch.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://images.naldzgraphics.net/2015/08/15-apple-watch-gui-sketch.jpg" height="240" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">대부분 멋있는 UI는 기본 GUI를 응용한 것입니다.</td></tr>
</tbody></table>
<br />
<br />
마지막으로 유니티 UI에서 제공하는 유용한 기능을 소개하겠습니다. 그것은 바로 유니티 이벤트(Unity Event)입니다.<br />
GUI는 사용자와 상호작용해야 하므로 사용자 조작에 대한 반응을 구현해야 합니다. 문제는 이런 GUI 상호작용을 위해 프로그래밍을 해야 하기에 초보자들은 어려울 수 밖에 없습니다.<br />
유니티는 GUI 상호작용 구현에 어려움을 겪는 초보자들을 위해 유니티 이벤트 기능을 만들었습니다.<br />
유니티 이벤트는 Inspector Window에서 볼 수 있으며 유니티 UI관련 컴포넌트가 유니티 이벤트를 가지고 있습니다.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://answers.unity3d.com/storage/temp/41966-unityeventoverride.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://answers.unity3d.com/storage/temp/41966-unityeventoverride.png" height="140" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">유니티 이벤트 메뉴</td></tr>
</tbody></table>
<br />
유니티 이벤트를 사용하면 해당 GUI에서 발생하는 이벤트에서 지정한 기능을 수행할 수 있습니다. 이 과정은 코딩없이 Inspector Window에 컴포넌트를 드래그하고 실행할 기능을 고르는 것으로 쉽게 해결할 수 있습니다.<br />
유니티 이벤트를 적절히 사용하면 디자인한 GUI가 사용자와 상호작용하는 결과물을 얻을 수 있습니다.<br />
<br />
<br />Anonymoushttp://www.blogger.com/profile/10315630713623521810noreply@blogger.com0tag:blogger.com,1999:blog-2144160700871786133.post-55451166734155172872016-09-19T11:47:00.004+09:002016-09-19T11:48:34.439+09:00ArdunityApp Stream ClassArdunityApp은 Stream Class를 선택할 수 있는 옵션을 제공합니다.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhC9qeRcCLxVwRy6F4T82aFMUwu1uTWutGIfcgyrd7JlOQiBzVLRqsxdlc3KGS6mjFJPlbl1IsyoDVjH9zsusD0gVF4O67g5n2d6joeLltvOT42ILP0viK2r94IbWO7jcEGf1tgxZvz5do/s1600/ArdunityApp+StreamClass.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="256" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhC9qeRcCLxVwRy6F4T82aFMUwu1uTWutGIfcgyrd7JlOQiBzVLRqsxdlc3KGS6mjFJPlbl1IsyoDVjH9zsusD0gVF4O67g5n2d6joeLltvOT42ILP0viK2r94IbWO7jcEGf1tgxZvz5do/s320/ArdunityApp+StreamClass.png" width="320" /></a></div>
<br />
아두니티에서 Sketch Option은 아두이노 스케치 생성 시 필요한 옵션을 의미합니다. 따라서, Sketch Option에 따라 생성될 아두이노 스케치는 변경되며 이것을 적용하기 위해서는 아두이노 보드에 변경된 아두이노 스케치를 업로드해야 합니다.<br />
<br />
아두이노에서 Stream Class란 외부와 통신을 하기 위한 라이브러리를 의미합니다.<br />
아두이노 Uno의 경우 기본적으로 PC와 통신할 수 있는 Serial Class가 있는데, 이것이 바로 Stream Class입니다.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://cdn.instructables.com/FR2/1V4Y/HU7GE879/FR21V4YHU7GE879.MEDIUM.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="320" src="https://cdn.instructables.com/FR2/1V4Y/HU7GE879/FR21V4YHU7GE879.MEDIUM.jpg" width="301" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">아두이노 Serial Class를 이용한 PC와 통신 예제</td></tr>
</tbody></table>
<br />
아두이노 보드에는 UART(Universal Asynchronous Receiver/Transmitter)라 부르는 하드웨어가 내장되어 있습니다. UART는 흔히 시리얼 통신이라 부르는 통신 방식을 지원하는 하드웨어 장치로써 전송을 위한 TX 핀과 수신을 위한 RX 핀으로 연결됩니다.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEibydiy27-O6i_cBdtp3QYTgubNZq8IJ6JTGfkq6Nh4g9hlTw5_DAWybCcxYt-Nf65DN0adOHmXSIejvgQSrLf3F_ZjllWkakDfQEH_UwoFawUcm6lAXShgpAII97N4dWPoIOFUphD-o0c/s1600/UART+Wiring.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="121" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEibydiy27-O6i_cBdtp3QYTgubNZq8IJ6JTGfkq6Nh4g9hlTw5_DAWybCcxYt-Nf65DN0adOHmXSIejvgQSrLf3F_ZjllWkakDfQEH_UwoFawUcm6lAXShgpAII97N4dWPoIOFUphD-o0c/s320/UART+Wiring.png" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">UART 연결 시 두 장치는 꼬임(Twisted Pair) 연결을 해야 한다.</td></tr>
</tbody></table>
<br />
두 장치간 통신 시 신호 레벨(전압)을 맞추는 것은 매우 중요합니다. UART는 5V 혹은 3.3V로 신호 레벨을 맞춰야 하는데, PC의 USB를 UART로 변환하는 USB2Serial 부품이 아두이노에 연결되어 아두이노 보드가 UART로 PC와 USB로 통신할 수 있는 것입니다.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcQ-oz10G2ngBAlUWOqG8AnN6-bHAXBIyHdUveBqzJ6MHs_IMHQcQA" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="114" src="https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcQ-oz10G2ngBAlUWOqG8AnN6-bHAXBIyHdUveBqzJ6MHs_IMHQcQA" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">아두이노 보드에는 USB2Serial이 내장되어 있다.</td></tr>
</tbody></table>
<br />
어쨌든, 아두이노에서 UART를 이용해 통신을 하려면 Serial Class를 사용해야 합니다. 아두이노 Uno의 경우는 UART가 하나이지만, 아두이노 다른 종류 보드는 UART를 여러 개 가지고 있습니다.<br />
<ul>
<li>아두이노 Uno는 UART가 1개이다.</li>
<li>아두이노 Leonardo는 UART가 2개이다.</li>
<li>아두이노 Mega, Due는 UART가 4개이다.</li>
</ul>
<div>
이렇게 UART가 여러개인 경우 Serial Class는 Serial(혹은 Serial0), Serial1, Serial2, Serial3로 이름을 갖게 됩니다.</div>
<div>
따라서, ArdunityApp에서 유니티와 통신할 UART를 선택할 수 있습니다.</div>
<div>
<br /></div>
<div>
UART를 사용하지 않고, 일반 Digital 핀으로 시리얼 통신을 할 수 있습니다.</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://embedded-lab.com/blog/wp-content/uploads/2010/12/AsyncSerial.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://embedded-lab.com/blog/wp-content/uploads/2010/12/AsyncSerial.png" height="80" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">시리얼 통신 규격에 맞춰 Digital 신호를 만들어 통신할 수 있다.</td></tr>
</tbody></table>
<div>
<br /></div>
<div>
아두이노에서 이와 같은 방식을 Software Serial이라 부릅니다. 아두이노 Uno의 경우 UART가 1개이기 때문에 UART통신 부품을 연결해야 할 때, Software Serial을 이용해서 이를 대체할 수 있습니다.</div>
<div>
대표적으로 HC-06과 같은 블루투스 SPP 통신 모듈의 경우 Software Serial을 이용해서 아두이노 보드와 연결해서 쓰고 있습니다.</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEietMiTqVlyksRNE8guKMtLTvrSX3GOx78DRg8e8R0ie1N-JUnhPtoq4xjbzhr7hR5rpBu9beJ_7ZjjV2Br0rP73EUf-vFfDuAsLyh3cDDHyYEySL9Db8HOOHn5invhvOGFgpUz88mtMxkJ/s1600/Arduino+Bluetooth.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="193" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEietMiTqVlyksRNE8guKMtLTvrSX3GOx78DRg8e8R0ie1N-JUnhPtoq4xjbzhr7hR5rpBu9beJ_7ZjjV2Br0rP73EUf-vFfDuAsLyh3cDDHyYEySL9Db8HOOHn5invhvOGFgpUz88mtMxkJ/s1600/Arduino+Bluetooth.png" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">HC-06을 UART에 연결해서 사용하는 경우</td></tr>
</tbody></table>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj7dQTz0blkiotHSmm0gH5aQjBHzmfqr6Fm09gO4aP_P12CXiUJO63d-Fb8wzxHfEDXDEsFjadbWeO1mgBotVXJwbBhPgHk_YPiB-DfXB7TtYai8VlWlV0EFenQIvBTbQRgMk3qnDzSrtU/s1600/HC-06+SoftwareSerial.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj7dQTz0blkiotHSmm0gH5aQjBHzmfqr6Fm09gO4aP_P12CXiUJO63d-Fb8wzxHfEDXDEsFjadbWeO1mgBotVXJwbBhPgHk_YPiB-DfXB7TtYai8VlWlV0EFenQIvBTbQRgMk3qnDzSrtU/s320/HC-06+SoftwareSerial.png" width="308" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">HC-06을 SoftwareSerial에 연결해서 사용하는 경우</td></tr>
</tbody></table>
<div>
<br /></div>
<div>
SoftwareSerial을 사용하려면 TX와 RX역할을 할 핀을 지정해줘야 합니다.</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj01QKCOmELCCKlSznLwkld2-444Hktq5Et6Fvxbvv8F45U33YbhtUpNkjnTLzEGnd8jm2TA0faxYZe9zBsUhp_-6Y7wEGbv7jaVYjxUVlMnWSUj256j5B3IRkSmYCzV1CmBVBpbNtWvu8/s1600/ArdunityApp+SoftwareSerial.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="155" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj01QKCOmELCCKlSznLwkld2-444Hktq5Et6Fvxbvv8F45U33YbhtUpNkjnTLzEGnd8jm2TA0faxYZe9zBsUhp_-6Y7wEGbv7jaVYjxUVlMnWSUj256j5B3IRkSmYCzV1CmBVBpbNtWvu8/s320/ArdunityApp+SoftwareSerial.png" width="320" /></a></div>
<div>
<br /></div>
<div>
SoftwareSerial을 사용하면 비용없이 UART를 추가할 수 있기때문에 편리합니다. 그러나, SoftwareSerial은 몇 가지 단점을 갖고 있기 때문에 사용에 주의해야 합니다.</div>
<div>
<ul>
<li>SoftwareSerial은 여러 개를 연결해도 한번에 1개씩만 통신할 수 있다.</li>
<li>통신 속도 9600bps 이상은 불안정하여 사용하기 어렵다.</li>
<li>SoftwareSerial은 Timer1을 사용하기에 Servo모터와 함께 사용할 수 없다.</li>
</ul>
<div>
<br /></div>
</div>
<div>
AltSoftSerial은 SoftwareSerial의 단점을 보완한 매우 유용한 Stream Class입니다. ArdunityApp은 AltSoftSerial을 사용하여 통신하는 것을 지원합니다. 하지만, AltSoftSerial을 사용하려면 AltSoftSerial 라이브러리가 아두이노 IDE에 설치되어야 합니다.</div>
<div>
AltSoftSerial 라이브러리를 설치하기 위해서는 아두이노 IDE의 라이브러리 관리 메뉴를 열어서 AltSoftSerial로 검색하면 쉽게 설치할 수 있습니다.</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiBSa2DnKbcDUi93X-yPEnQ7z7otxnWBNmDQaBpg1Y5x7pxlDviTi88Cmm6eA-Negtfc1zqupyIPqu__Oq74q6hL6Xoef0c28uOWUh1AZQQFrEXsYfR89XZ0ddS0RSt84Ji9w-XkUqPXfU/s1600/AltSoftSerial+Library.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="225" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiBSa2DnKbcDUi93X-yPEnQ7z7otxnWBNmDQaBpg1Y5x7pxlDviTi88Cmm6eA-Negtfc1zqupyIPqu__Oq74q6hL6Xoef0c28uOWUh1AZQQFrEXsYfR89XZ0ddS0RSt84Ji9w-XkUqPXfU/s400/AltSoftSerial+Library.png" width="400" /></a></div>
<div>
<br /></div>
<div>
AltSoftSerial은 사용법이 SoftwareSerial과 비슷하지만, TX와 RX 핀이 고정되어 있습니다.</div>
<div>
<ul>
<li>아두이노 Uno, Due는 TX(9), RX(8) 핀을 사용합니다.</li>
<li>아두이노 Leonardo, Yun은 TX(5), RX(13) 핀을 사용합니다.</li>
<li>아두이노 Mega는 TX(46), RX(48) 핀을 사용합니다.</li>
</ul>
<div>
SoftwareSerial과 달리 TX와 RX 핀을 변경할 수 없기때문에 Sketch Option에 핀 설정 메뉴가 없습니다.</div>
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhjaJlxmUdvHIEK3UoaOpgt0vAVUkN-Cwztlkk9PeB-glrOpYtP6pfhNjOuL4lfqkJzxYDxU6yKdEWwi8YL9PD1UlNuY-4VYHP5Q1J8N_HS9YOQGEdBIIcqIclA725twL6RD-CcOmHQPyU/s1600/ArdunityApp+AltSoftSerial.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="114" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhjaJlxmUdvHIEK3UoaOpgt0vAVUkN-Cwztlkk9PeB-glrOpYtP6pfhNjOuL4lfqkJzxYDxU6yKdEWwi8YL9PD1UlNuY-4VYHP5Q1J8N_HS9YOQGEdBIIcqIclA725twL6RD-CcOmHQPyU/s320/ArdunityApp+AltSoftSerial.png" width="320" /></a></div>
<div>
<br /></div>
<div>
AltSoftSerial은 다음과 같은 특성이 있습니다.</div>
<div>
<ul>
<li>TX, RX 핀이 고정되어있으므로 1개만 사용할 수 있다.</li>
<li>고속 통신 속도(Baudrate)를 사용할 수 있다.</li>
<li>일부 PWM 핀을 동시에 사용할 수 없다. (보드마다 다르므로 확인해야 함)</li>
</ul>
<div>
<br /></div>
</div>
<div>
마지막으로 Bridge Class에 대해 설명하겠습니다.</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhOc8YGioGR0wiL2d6Q3OkRrwt9QA4SbueY_Ye9JXWeIqE11CbVpz-VDa9Qgc8NT2QTXFNjMWdbrZoktU-XxM8lDyNptYH9RytMGBSzDidy7nOJvjlGBG9a4qOxYNKDFEbnX22ew-4zEeY/s1600/ArdunityApp+Bridge.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="97" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhOc8YGioGR0wiL2d6Q3OkRrwt9QA4SbueY_Ye9JXWeIqE11CbVpz-VDa9Qgc8NT2QTXFNjMWdbrZoktU-XxM8lDyNptYH9RytMGBSzDidy7nOJvjlGBG9a4qOxYNKDFEbnX22ew-4zEeY/s320/ArdunityApp+Bridge.png" width="320" /></a></div>
<div>
<br /></div>
<div>
아두이노 Yun 보드의 경우 WiFi 통신을 위해 AR9331 칩이 내장되어 있으며, 이 칩에는 OpenWrt라 부르는 리눅스 OS가 실행되고 있습니다.</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://www.arduino.cc/en/uploads/Main/A000008_featured.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="240" src="https://www.arduino.cc/en/uploads/Main/A000008_featured.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">아두이노 Yun 보드</td></tr>
</tbody></table>
<div>
<br /></div>
<div>
즉, 아두이노 Yun 보드는 CPU가 2개가 있는 것이고 각각의 역할은 다음과 같습니다.</div>
<div>
<ul>
<li>아두이노 Uno와 같이 핀 제어 역할</li>
<li>WiFi를 검색하고 연결하는 역할</li>
</ul>
<div>
이 두 칩은 통신을 위해 UART로 연결되지 않았고, 고유의 프로토콜을 사용합니다. Bridge Class는 아두이노 Yun에서만 사용되는 Stream Class이며 아두이노 보드가 인터넷으로 통신할 수 있게 만들어줍니다.</div>
</div>
<div>
ArdunityApp은 아두이노 Yun보드를 위한 Bridge Class를 지원하므로 인터넷을 통한 아두이노와 유니티 통신이 가능합니다.</div>
<div>
<br /></div>
<div>
<br /></div>
Anonymoushttp://www.blogger.com/profile/10315630713623521810noreply@blogger.com0tag:blogger.com,1999:blog-2144160700871786133.post-11112409573547541152016-09-18T16:34:00.003+09:002016-09-18T16:35:52.701+09:00아두이노 I2C통신I2C(Inter Integrated Circuit)는 대표적인 칩간 통신 규격으로 필립스에서 개발하여 임베디드 시스템 개발 시 널리 사용되고 있습니다.<br />
아두이노에서도 이 I2C를 사용하여 부품을 제어할 수 있습니다.<br />
아두이노에서 기초적인 제어 방식은 다음과 같습니다.<br />
<ul>
<li>Digital 핀을 이용해서 On/Off할 수 있다.</li>
<li>Digital 핀을 이용해서 스위치 등의 상태를 확인할 수 있다.</li>
<li>PWM 핀을 이용해서 전기 출력을 조절할 수 있다.</li>
<li>Analog 핀을 이용해서 센서의 상태를 확인할 수 있다.</li>
</ul>
<div>
이것만으로도 할 수 있는 것은 많지만, 더 복잡한 기능을 수행하려면 턱없이 부족합니다. 하드웨어에서 복잡한 기능을 효과적으로 구현하는 방법은 바로 IC로 만드는 것입니다.</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://3.imimg.com/data3/IB/QR/GLADMIN-30758/ic-chip-250x250.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://3.imimg.com/data3/IB/QR/GLADMIN-30758/ic-chip-250x250.jpg" height="200" width="200" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">하드웨어는 필요한 기능을 IC로 만들 수 있다.</td></tr>
</tbody></table>
<div>
<br /></div>
<div>
이렇게 만들어진 IC로 아두이노에서 제어하려면 Digital/Analog 핀만으로는 다루기 어렵습니다. 그래서, 통신이라는 것이 필요하고 통신을 위해 프로토콜(통신 방식)을 사용합니다.</div>
<div>
I2C는 바로 IC로 만들어진 기능을 쉽게 사용하기 위한 대표적인 방법입니다.</div>
<div>
I2C는 버스(Bus)라 불리는 하나의 선으로 여러 장치를 효과적으로 제어할 수 있는 기능을 제공합니다.</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://www.esacademy.com/assets/images/g01proto.gif" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://www.esacademy.com/assets/images/g01proto.gif" height="80" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">I2C 버스의 개념</td></tr>
</tbody></table>
<div>
<br /></div>
<div>
아두이노에서는 I2C통신을 지원하는 부품을 여러 개 연결해서 사용할 수 있다는 뜻입니다. 버스 통신은 하나의 선을 여러 장치가 사용하므로 충돌없이 통신할 수 있도록 다음의 개념이 필요합니다.</div>
<div>
<ul>
<li>Master: 통신을 시작할 수 있는 권한이 있다. 반드시 한개만 존재해야 한다.</li>
<li>Slave: Master의 요구에 응답만 할 수 있다.</li>
<li>Address: 자신을 구별할 일종의 ID이다.</li>
</ul>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://www.totalphase.com/support/article_attachments/200093557/i2c-diagram.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://www.totalphase.com/support/article_attachments/200093557/i2c-diagram.png" height="110" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">I2C Master/Slave 개념</td></tr>
</tbody></table>
<div>
<br /></div>
</div>
<div>
아두이노에서 I2C를 사용하기 위해서는 2개의 핀이 필요합니다.</div>
<div>
<ul>
<li>SDA: 아두이노 Uno에서는 A4 핀이 이 역할을 한다.</li>
<li>SCK: 아두이노 Uno에서는 A5 핀이 이 역할을 한다.</li>
</ul>
<div class="separator" style="clear: both; text-align: center;">
</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://tronixstuff.com/wp-content/uploads/2010/10/arduino-uno-i2c-pin.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://tronixstuff.com/wp-content/uploads/2010/10/arduino-uno-i2c-pin.png" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">아두이노에서 I2C 핀</td></tr>
</tbody></table>
<div>
<br /></div>
</div>
<div>
<u><span style="color: red;">아두이노 보드의 종류마다 SDA/SCK 역할을 하는 핀이 다르므로 잘 확인해야 합니다.</span></u></div>
<div>
<br /></div>
<div>
하드웨어 연결을 잘 했다면, I2C 통신을 위해 스케치를 작성해야 합니다.</div>
<div>
아두이노는 I2C 통신을 위해 Wire라 부르는 라이브러리를 제공합니다. (<a href="https://www.arduino.cc/en/Reference/Wire" target="_blank">Wire 라이브러리 사용법</a>)</div>
<br />
<b><아두이노 보드가 Master역할을 하는 경우></b><br />
<span style="color: blue;">#include</span> <Wire.h> <span style="color: #38761d;">// using Wire Library</span><br />
<br />
<span style="color: blue;">void</span> setup()<br />
{<br />
Wire.begin(); <span style="background-color: white;"><span style="color: #38761d;">// Start I2C Master</span></span><br />
}<br />
<br />
<span style="color: blue;">void</span> loop()<br />
{<br />
<span style="color: #38761d;">// Write data to Slave</span><br />
Wire.beginTransmission(3); <span style="color: #38761d;">// Slave address is 3</span><br />
Wire.write(data);<br />
Wire.endTransmission();<br />
<br />
<br />
<span style="color: #38761d;">// Read data from Slave</span><br />
Wire.requestFrom(3, 6); <span style="color: #38761d;">// Slave address is 3, Data length is 6</span><br />
<span style="color: blue;">while</span>(Wire.available()) <span style="color: #38761d;">// Wait data until completed</span><br />
{<br />
Wire.read(); <span style="color: #38761d;">// Get data from buffer</span><br />
}<br />
}<br />
<br />
<br />
<b><아두이노 보드가 Slave역할을 하는 경우></b><br />
<span style="color: blue;">#include</span> <Wire.h> <span style="color: #38761d;">// using Wire Library</span><br />
<br />
<span style="color: blue;">void</span> setup()<br />
{<br />
Wire.begin(5); <span style="color: #38761d;">// Set address of Slave</span><br />
Wire.onReceive(OnReceived); <span style="color: #38761d;">// Set callback for writing of Master</span><br />
Wire.onRequest(OnRequested); <span style="color: #38761d;">// Set callback for requesting of Master</span><br />
}<br />
<br />
<span style="color: blue;">void</span> OnReceived(<span style="color: blue;">int</span> numByte)<br />
{<br />
<span style="color: #38761d;">// When received from Master</span><br />
<span style="color: blue;">while</span>(Wire.available()) <span style="color: #38761d;">// Wait data until completed</span><br />
{<br />
Wire.read(); <span style="color: #38761d;">// Get data from buffer</span><br />
} <br />
}<br />
<br />
<span style="color: blue;">void</span> OnRequested()<br />
{<br />
<span style="color: #38761d;">// When requested from Master</span><br />
Wire.write(data);<br />
}<br />
<br />
<br />
실제로 I2C를 통해 어떤 데이터를 주고 받을 지에 대해서는 해당 부품의 데이터시트(Data Sheet)를 확인해야 합니다.<br />
<br />
<br />Anonymoushttp://www.blogger.com/profile/10315630713623521810noreply@blogger.com0tag:blogger.com,1999:blog-2144160700871786133.post-87587457747228467032016-09-18T15:27:00.002+09:002017-07-25T13:03:50.682+09:00블루투스와 아두이노블루투스는 대표적인 근거리 무선 통신 방식입니다. 근거리 무선 통신을 전문적인 용어로 PAN(Personal Area Network)이라 부릅니다.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://cdn.sparkfun.com/assets/4/b/e/e/9/5213ccb1757b7f4c568b4568.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="200" src="https://cdn.sparkfun.com/assets/4/b/e/e/9/5213ccb1757b7f4c568b4568.jpg" width="200" /></a></div>
<div>
<br /></div>
<div>
스마트 폰과 같은 개인용 무선 기기들이 블루투스를 채택하면서 블루투스는 자연스럽게 근거리 무선 통신 표준으로 자리 잡았습니다.</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcRKSvfudB1_V9SMOna9KKhV_7fo9_WNzsmu_yclHqO5FXL6HYjO" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="200" src="https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcRKSvfudB1_V9SMOna9KKhV_7fo9_WNzsmu_yclHqO5FXL6HYjO" width="200" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">많은 기기들이 블루투스를 무선 통신 규격으로 사용한다.</td></tr>
</tbody></table>
<div>
<br /></div>
<div>
이 포스트에서는 블루투스를 개발에 활용하기 위해 필요한 상식을 소개하겠습니다.</div>
<div>
블루투스에는 프로파일(Profile)이라 부르는 통신 프로토콜 규격이 있습니다. 프로파일의 역할은 하드웨어 제조사들이 통신 소프트웨어 개발 없이 규격에 맞추기만 하면 바로 사용할 수 있도록 만들어줍니다. 예를 들어 블루투스 이어폰 제품이 많이 나온 것은 블루투스에 핸즈 프리와 통화 및 오디오 전송과 관련된 프로파일이 있기 때문입니다.</div>
<div>
<br /></div>
<div>
블루투스에 포함된 프로파일 중 SPP(Serial Port Profile)은 새로운 장치를 개발하는 사람들이 많이 사용하는 프로파일 입니다. SPP는 시리얼 포트 프로파일로써 시리얼 통신과 비슷한 방식으로 블루투스를 무선 통신으로 사용할 수 있습니다.</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://i.ytimg.com/vi/PlCk49w56Nw/maxresdefault.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="180" src="https://i.ytimg.com/vi/PlCk49w56Nw/maxresdefault.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">아두이노 무선 통신은 대부분 블루투스 SPP를 이용한 것이다.</td></tr>
</tbody></table>
<div>
<br /></div>
<div>
블루투스 SPP를 지원하면서 아두이노에서 널리 쓰이는 모듈은 HC-06입니다.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgnlRrLTmj30c42lCYOjtbN6Ppc8KoItsLPUiVyvIrDmKSrggECz5u_lB8W6faZYXvT9wt_YIL2E_EjJnMUm7goo1a24pWzzYjQGq99lQUQF_0WZtypNQg0Nm5gxisHIPFCE7a-4UTp0YA/s1600/hc06.jpeg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" data-original-height="225" data-original-width="225" height="200" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgnlRrLTmj30c42lCYOjtbN6Ppc8KoItsLPUiVyvIrDmKSrggECz5u_lB8W6faZYXvT9wt_YIL2E_EjJnMUm7goo1a24pWzzYjQGq99lQUQF_0WZtypNQg0Nm5gxisHIPFCE7a-4UTp0YA/s200/hc06.jpeg" width="200" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">HC-06</td></tr>
</tbody></table>
<br /></div>
<div>
아두이노에서 블루투스 SPP를 사용하다면 관련된 많은 자료와 필요한 부품을 쉽게 구할 수 있습니다.</div>
<div>
하지만, 블루투스 SPP는 다음과 같은 어려움을 갖고 있습니다.</div>
<div>
<ul>
<li>블루투스 4.0부터는 SPP를 더이상 지원하지 않습니다.</li>
<li>iOS에서는 SPP를 사용할 수 없습니다.</li>
</ul>
<div>
<br /></div>
</div>
<div>
블루투스는 규격을 점차적으로 발전시켜왔는데, 4.0부터 IoT의 대표적 통신 솔루션이 된다는 목표를 두고 큰 변화를 취했습니다.</div>
<div>
<ul>
<li>기존의 1:1 연결 방식에서 1:N 연결을 지원한다.</li>
<li>연결의 절차를 간소화하고 빠르게 만들었다. (패어링 개념을 없앴다.)</li>
<li>전력 소모를 줄였다. (Low Energy 실현)</li>
<li>프로파일의 자유도를 높였다.</li>
</ul>
<div>
이런 변화로 인해서 블루투스 4.0은 이전까지의 블루투스와 다르다는 점을 강조하기 위해 조금 다른 명칭을 사용했는데, BLE(Bluetooth Low Energy) 혹은 블루투스 스마트라는 이름으로 알려지기 시작했습니다.</div>
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://profileimages.guru.com/1/612/1612629/bluetooth_low_energy_logo_4.0_smartphones_big_f2bfdd08-a9a2-4b30-be72-f0406c13107c.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://profileimages.guru.com/1/612/1612629/bluetooth_low_energy_logo_4.0_smartphones_big_f2bfdd08-a9a2-4b30-be72-f0406c13107c.png" height="133" width="200" /></a></div>
<div>
<br /></div>
<div>
더군다나 iOS의 경우 기존 블루투스의 경우 자체 규격을 받지 않으면 지원하지 않는 등의 폐쇄적인 정책을 취했는데, 블루투스 4.0은 자체 규격없이 그대로 받아들이기 시작했다는 것입니다.</div>
<div>
<br /></div>
<div>
겉으로 볼 때는 블루투스 4.0이 되면서 아두이노와 같은 사용자 장치 개발에 아주 좋아졌다고 보입니다.</div>
<div>
<ul>
<li>이제 iOS 장치와 무선 통신을 할 수 있게 되었다.</li>
<li>기존에 아두이노 보드 1대만 연결했는데, 여러 대를 연결할 수 있게 되었다.</li>
<li>저 전력으로 인해 전원 공급이 수월해졌다.</li>
</ul>
<div>
위와 같은 장점이 있는 반면에 생각치도 못한 다른 문제가 발생했습니다. 그것은 바로 블루투스 SPP를 더 이상 지원하지 않는다는 것입니다.</div>
</div>
<div>
블루투스 4.0은 다양한 장치를 위해 프로파일의 자유도를 높이면서 SPP의 필요성을 느끼지 못하고 제거했습니다. 프로파일의 장점은 소프트웨어 개발 없이 하드웨어를 만들 수 있는 것인데, SPP가 사라지면서 아두이노를 이용해서 블루투스 무선 통신을 하려는 경우 직접 블루투스 프로파일을 개발해야 합니다.</div>
<div>
물론, 블루투스 4.0에서 IoT 장치를 위한 새로운 프로파일들이 등장했습니다.</div>
<div>
하지만, 기존 SPP와 같이 사용하기에는 어려운 점이 많습니다.</div>
<div>
이런 문제로 블루투스 4.0이 나왔지만, 아두이노에서는 여전히 블루투스 SPP가 활용되고 있습니다.</div>
<div>
블루투스 4.0 통신을 할 수 있는 아두이노용 부품들이 개발되어 판매되고 있지만, 그에 상대되는 앱(App)을 만들기 어려워서 테스트용으로 배포된 앱으로 실험하는 정도에 그치고 있습니다.</div>
<div>
아두이노용으로 많이 사용되는 블루투스 4.0 모듈인 HM-10의 경우 SPP와 비슷한 프로파일을 제공하고 있습니다.</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://mikrocontroller-praxis.de/media/images/info/hm-10.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://mikrocontroller-praxis.de/media/images/info/hm-10.jpg" height="133" width="200" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">아두이노용 블루투스 4.0 모듈인 HM-10</td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://www.lapis-semi.com/en/semicon/telecom/images/ble_pic_3@2x.gif" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://www.lapis-semi.com/en/semicon/telecom/images/ble_pic_3@2x.gif" height="171" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">블루투스 4.0을 테스트할 수 있는 앱이 많이 있다.</td></tr>
</tbody></table>
<div>
<br /></div>
<div>
아두이노에서 무선 통신에 대한 관심이 높아지면서 블루투스 활용에 대해서 많은 연구가 이루어졌습니다. 블루투스를 활용하려면 반드시 앱을 제작해야 하는데, 아두이노에 비해서 앱 개발 환경은 아직 초보자들에게 쉽지 않습니다.</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://imag.malavida.com/mvimgbig/download-fs/android-studio-12654-1.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://imag.malavida.com/mvimgbig/download-fs/android-studio-12654-1.jpg" height="231" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Android Studio 모습</td></tr>
</tbody></table>
<div>
<br /></div>
<div>
안드로이드 앱 개발에 많이 사용되는 Android Studio의 경우 초보자들이 다루기에 매우 어렵습니다. 임베디드 개발 환경이 아두이노가 나오면서 대중화되었듯이 앱 개발 환경도 대중화되기 위해서는 뭔가 혁신이 필요해 보입니다.</div>
<div>
<br /></div>
<div>
<br /></div>
Anonymoushttp://www.blogger.com/profile/10315630713623521810noreply@blogger.com1tag:blogger.com,1999:blog-2144160700871786133.post-6102178780447867112016-09-16T16:09:00.001+09:002016-09-16T16:09:16.173+09:00유니티 빌드(Build)빌드(Build)는 개발된 소프트웨어를 사용자 장치에서 실행할 수 있도록 만드는 작업을 의미합니다.<div>
유니티에서 빌드는 유니티 에디터없이 작업한 Scene이 사용자 장치에서 실행할 수 있도록 만드는 것입니다.</div>
<div>
유니티는 멀티 플랫폼 빌드(Multi-Platform Build)를 지원하는데, 이것은 다양한 OS 장치에서 작업한 결과물이 실행할 수 있도록 만들 수 있다는 뜻입니다.</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://www.presentationsimulator.com/wp-content/uploads/2015/06/unity-multiplatform-support.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://www.presentationsimulator.com/wp-content/uploads/2015/06/unity-multiplatform-support.jpg" height="76" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">유니티는 매우 많은 OS별 실행 결과물을 만들 수 있다.</td></tr>
</tbody></table>
<div>
<br /></div>
<div>
유니티에서 빌드는 Build Setting 메뉴에서 처리됩니다.</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhkAN3zXe4lTfDi-o7YIbaItC7wdEDFqnLkXzM3mqU9NJJbG1dl8Kd393s-jCUyfkZfUgaFo3OrKI4zGui4WhsLo4vA1QUoVPMWaHabdI4OraGQuuo0ucY__TjeKiorHYLZhV5J31YLusk/s1600/Unity+BuildSetting+Menu.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhkAN3zXe4lTfDi-o7YIbaItC7wdEDFqnLkXzM3mqU9NJJbG1dl8Kd393s-jCUyfkZfUgaFo3OrKI4zGui4WhsLo4vA1QUoVPMWaHabdI4OraGQuuo0ucY__TjeKiorHYLZhV5J31YLusk/s320/Unity+BuildSetting+Menu.png" width="260" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">유니티 Build Setting 메뉴</td></tr>
</tbody></table>
<div>
<br /></div>
<div>
이 메뉴를 실행하면 Build Setting 관리자가 실행됩니다.</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://developer3.oculus.com/images/documentation/game-engines/latest/capt-unity-build-mac.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="320" src="https://developer3.oculus.com/images/documentation/game-engines/latest/capt-unity-build-mac.png" width="293" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">유니티 Build Setting 관리자</td></tr>
</tbody></table>
<div>
<br /></div>
<div>
여기서 할 수 있는 일은 다음과 같습니다.</div>
<div>
<ul>
<li>보여줄 Scene의 선택</li>
<li>빌드 플랫폼 선택</li>
<li>빌드 옵션 선택</li>
<li>빌드 기능</li>
</ul>
<div>
<br /></div>
</div>
<div>
유니티는 작업 결과를 Scene 단위로 저장합니다. 따라서, 여러분은 빌드하기 전에 어떤 Scene을 포함시킬 것인지 결정해야 합니다.</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://docs.unity3d.com/uploads/Main/BuildSettings.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="305" src="https://docs.unity3d.com/uploads/Main/BuildSettings.png" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Build Setting에 Scene이 포함된 모습</td></tr>
</tbody></table>
<div>
<br /></div>
<div>
빌드 플랫폼은 쉽게 말해서, 어떤 OS용 실행 파일을 만들 것이냐 이며 대표적으로 Windows/Mac/Android/iOS 등이 있습니다. 빌드 플랫폼을 선택하려면 반드시 Build Support가 이미 설치되어있어야 하는데, 이것은 유니티 설치 시 컴포넌트 선택 메뉴에서 선택되어야 합니다. 만약, 빌드할 플랫폼을 선택할 수 없다면, 유니티를 다시 설치하여 필요한 컴포넌트를 선택해야 합니다.</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://s21.postimg.org/642vfxu5j/Screen_Shot_2016_01_06_at_11_30_36.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://s21.postimg.org/642vfxu5j/Screen_Shot_2016_01_06_at_11_30_36.png" height="193" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">유니티 설치 시 해당 플랫폼 Build Support를 선택해야 한다.</td></tr>
</tbody></table>
<div>
<br /></div>
<div>
빌드 옵션은 전문적인 내용이라 여기서는 다루지 않겠습니다. 쉽게 말하면 Windows 32bit/64bit 등의 옵션이 빌드 옵션에 해당됩니다.</div>
<div>
<u><span style="color: red;">이렇게 하고 빌드 버튼을 누르면 결과물을 저장할 위치를 묻는데, 절대로 빌드 결과는 유니티 프로젝트의 Assets 폴더에 만들면 안됩니다.</span></u></div>
<div>
<br /></div>
<div>
빌드를 하기 전에 반드시 설정해야 할 것이 있는데, 그것은 바로 Player Setting입니다.</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://developer3.oculus.com/images/documentation/game-engines/latest/capt-unity-android-player-settings.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="320" src="https://developer3.oculus.com/images/documentation/game-engines/latest/capt-unity-android-player-settings.png" width="315" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Player Setting 메뉴</td></tr>
</tbody></table>
<div>
<br /></div>
<div>
Player Setting은 빌드된 결과물이 실행하는 방법을 보다 상세하게 설정하는 메뉴가 포함되어 있습니다. 대부분 전문적인 내용이라 정확한 지식없이 함부로 바꾸지 않기를 추천합니다.</div>
<div>
다만, 프로그램 이름이나 아이콘, 실행 창의 형태 등은 설정해야 합니다. 플랫폼별 Player Setting 설정 방법은 향후 포스팅하겠습니다.</div>
<div>
<br /></div>
<div>
일부 플랫폼 빌드는 외부 도구가 필요할 수 있습니다.</div>
<div>
빌드는 해당 OS에서 실행 혹은 설치 가능한 파일을 의미하며 대표적인 파일 형태는 다음과 같습니다.</div>
<div>
<ul>
<li>Windows용 실행 파일은 exe확장자를 갖는다.</li>
<li>Mac(OSX)용 실행 파일은 app확장자를 갖는다.</li>
<li>Android용 설치 파일은 apk확장자를 갖는다.</li>
</ul>
<div>
Android와 iOS 경우는 유니티가 실행 혹은 설치가 가능한 파일을 만들어주지 않습니다. 그 대신 실행 혹은 설치가 가능한 파일을 만드는데 필요한 소스 파일을 만들어주기에 빌드를 완성하기 위해서는 외부 빌드 도구가 필요합니다.</div>
</div>
<div>
<ul>
<li>Android의 경우는 Android Studio가 외부 빌드 도구</li>
<li>iOS의 경우는 Xcode가 외부 빌드 도구</li>
</ul>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://blogldc.s3.amazonaws.com/wp-content/uploads/2014/12/studio-hero.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://blogldc.s3.amazonaws.com/wp-content/uploads/2014/12/studio-hero.jpg" height="168" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">안드로이드용 앱을 빌드하기 위한 Android Studio</td></tr>
</tbody></table>
<div>
<br /></div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://a3.mzstatic.com/us/r30/Purple62/v4/47/71/c8/4771c849-7694-45d0-6a76-d6b080798a26/icon128-2x.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://a3.mzstatic.com/us/r30/Purple62/v4/47/71/c8/4771c849-7694-45d0-6a76-d6b080798a26/icon128-2x.png" height="200" width="200" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">iOS용 앱을 빌드하기 위한 Xcode</td></tr>
</tbody></table>
<div>
<br /></div>
<div>
따라서, 여러분의 PC에 Android Studio 혹은 Xcode와 같은 외부 빌드 도구가 추가 설치되어야 합니다.</div>
</div>
<div>
유니티 빌드를 위한 도구를 정리하면 다음과 같습니다.</div>
<div>
<ul>
<li>유니티 (필수)</li>
<li>유니티 Build Support (필수)</li>
<li>플랫폼별 외부 빌드 도구 (옵션)</li>
</ul>
<div>
Android와 iOS용 앱을 빌드하기 위한 상세한 절차는 향후 포스팅하겠습니다.</div>
</div>
<div>
<br /></div>
<div>
유니티에서 가능한 빌드 플랫폼을 몇 가지 소개하겠습니다.</div>
<div>
<b>Windows 플랫폼</b></div>
<div>
Windows에서 실행되는 프로그램으로 Windows 10부터는 Windows Universal App이라 불리고 유니티에서 Windows Store 플랫폼으로 지원합니다.</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogs.unity3d.com/wp-content/uploads/2015/09/Windows10BuildSettings-561x200.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="114" src="https://blogs.unity3d.com/wp-content/uploads/2015/09/Windows10BuildSettings-561x200.png" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Windows Store는 Windows10용 앱을 지원합니다.</td></tr>
</tbody></table>
<div>
<br /></div>
<div>
<b>Mac(OSX) 플랫폼</b></div>
<div>
Mac 컴퓨터 OS는 OSX라고 부릅니다. 유니티는 Mac용 실행 파일을 만들 수 있습니다.</div>
<div>
<br /></div>
<div>
<b>Android 플랫폼</b></div>
<div>
안드로이드 폰 혹은 태블릿에서 실행 가능한 앱을 만들 수 있습니다. 유니티에서 만든 Android 앱은 Google Play Store에 올릴 수 있습니다.</div>
<div>
안드로이드 빌드를 하려면 반드시 Android Studio를 추가로 설치해야 합니다.</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://www.oneclickroot.com/wp-content/uploads/2014/05/google-play.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="167" src="https://www.oneclickroot.com/wp-content/uploads/2014/05/google-play.png" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">유니티에서 만든 앱은 Google Play Store에 올릴 수 있다.</td></tr>
</tbody></table>
<div>
<br /></div>
<div>
<b>iOS 플랫폼</b></div>
<div>
iOS는 아이폰과 아이패드를 의미합니다. 유니티를 이용하면 아이폰이나 아이패드에서 실행되는 앱을 제작할 수 있으며, 애플 앱 스토어에 빌드 결과물을 올릴 수 있습니다.</div>
<div>
iOS 플랫폼 빌드를 하려면 반드시 Mac 컴퓨터를 보유해야 하고, Xcode를 추가로 설치해야 합니다.</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://www.onbile.com/assets/websites/final/055/256/055256/touchvpn-vpn-for-ios.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://www.onbile.com/assets/websites/final/055/256/055256/touchvpn-vpn-for-ios.jpg" height="239" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">유니티에서 아이폰과 아이패드용 앱을 제작할 수 있다.</td></tr>
</tbody></table>
<div>
<br /></div>
<div>
<b>WebGL 플랫폼</b></div>
<div>
WebGL 플랫폼은 크롬이나 익스플러같은 웹 브라우저를 의미합니다. 유니티는 웹 브라우저에서 실행할 수 있는 결과물을 만들 수 있는데, 이것은 한때 인기를 누렸던 플래시 게임(Flash Game)과 같은 형태입니다.</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://img.sur.ly/thumbnails/620x343/e/en.gameslol.net.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://img.sur.ly/thumbnails/620x343/e/en.gameslol.net.png" height="177" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">웹 브라우저에서 실행된 플래시 게임은 한때 엄청난 인기를 누렸다.</td></tr>
</tbody></table>
<div>
<br /></div>
<div>
<b>XBox와 PlayStation 플랫폼</b></div>
<div>
XBox와 PlayStation은 대표적인 콘솔 게임 기기입니다. 유니티를 이용하면 여러분도 XBox와 PlayStation에서 실행되는 결과물을 만들 수 있습니다. 다른 플랫폼과 달리 XBox와 PlayStation 플랫폼은 별도의 라이센스 비용을 지불해야 사용할 수 있습니다.</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://imagescdn.tweaktown.com/news/4/1/41309_01_xbox_one_playstation_4_outpacing_xbox_360_playstation_3_sales.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://imagescdn.tweaktown.com/news/4/1/41309_01_xbox_one_playstation_4_outpacing_xbox_360_playstation_3_sales.jpg" height="179" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">유니티는 콘솔 게임 기기용 프로그램을 제작할 수 있다.</td></tr>
</tbody></table>
<div>
<br /></div>
<div>
유니티는 작업한 결과물이 수 많은 플랫폼에서 실행될 수 있도록 지원하는 플랫폼 수를 늘리기 위해 노력하고 있습니다.</div>
<div>
<br /></div>
<div>
<br /></div>
Anonymoushttp://www.blogger.com/profile/10315630713623521810noreply@blogger.com0tag:blogger.com,1999:blog-2144160700871786133.post-58647253498021986082016-09-16T14:24:00.002+09:002016-09-16T14:24:51.401+09:00전원 공급(Power Supply)전자 장치가 작동하기 위해서는 전원이 필요합니다.<br />
이 전원은 AC와 DC로 방식을 나눌 수 있습니다.<br />
AC(Alternating Current)는 우리말로 교류 전원이라 불리고, 주로 집에 있는 전기 콘센트가 이와 같은 방식을 사용합니다.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://sc01.alicdn.com/kf/HTB1czVmKVXXXXcDXpXXq6xXFXXXu/US-plug-gfci-usb-wall-outlet-sockets.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="200" src="https://sc01.alicdn.com/kf/HTB1czVmKVXXXXcDXpXXq6xXFXXXu/US-plug-gfci-usb-wall-outlet-sockets.jpg" width="200" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">AC 전원 공급 장치</td></tr>
</tbody></table>
<br />
AC는 아주 먼 거리에 전기를 공급할 때 유리하기에 발전소로부터 집까지 전달할 때 많이 사용하는 방식입니다.<br />
DC(Direct Current)는 우리말로 직류 전원이라 불리고 주로 전자 장치들이 이 방식의 전원을 사용합니다. 따라서, AC를 DC로 바꿀 수 있는 장치가 필요한데, 이것을 아답터(Adaptor)라 부릅니다.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://www.o-digital.com/uploads/2218/2220-1/Power_Adaptor_GA_202_10.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://www.o-digital.com/uploads/2218/2220-1/Power_Adaptor_GA_202_10.jpg" height="199" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">AC를 DC로 변환하는 아답터</td></tr>
</tbody></table>
<br />
대부분의 전자 장치는 이 아답터를 사용하거나 내장하고 있습니다.<br />
DC 전원은 전압과 전류로 그 용량을 표현합니다. 예를 들면 12V, 1000mA와 같은 방식입니다.<br />
전기적 힘은 와트(Watt)로 표현하는데, 이것은 전압 x 전류로써 12V, 1A는 12W가 됩니다. 이 뜻은 12V로 회로를 사용할 때 최대 1A까지 공급할 수 있다는 의미입니다.<br />
전원 공급 장치를 선택할 때는 이 와트를 정확하게 알고 결정해야 문제없이 사용할 수 있습니다.<br />
<br />
아두이노 보드는 전원 공급을 PC의 USB로 사용합니다.<br />
USB는 한 포트 당 5V, 200mA이므로 5 x 0.2 = 1W가 됩니다.<br />
여러분의 회로에서 필요로 하는 와트가 이보다 작다면 문제되지 않지만, 크다면 USB 포트에 무리를 주어 망가질 수 있음을 주의해야 합니다.<br />
<br />
아두이노 보드는 외부 전원을 사용할 수 있는 회로를 내장하고 있습니다. 이 회로는 AC를 DC로 변환하는 아답터가 아니고 5V를 안정적으로 공급할 수 있는 레귤레이터(Regulator) 회로를 갖고 있습니다.<br />
레귤레이터의 역할은 필요로 하는 전압보다 큰 전압이 공급되어도 안정적으로 필요한 전압을 공급합니다.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://cdn.sparkfun.com//assets/parts/9/9/00107-1.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="200" src="https://cdn.sparkfun.com//assets/parts/9/9/00107-1.jpg" width="200" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">레귤레이터 부품</td></tr>
</tbody></table>
<br />
아두이노 보드에 이 레귤레이터 회로가 내장되어있기에 6 ~ 20V까지 DC 전원을 공급해도 문제없이 사용할 수 있습니다. (권장 전압은 7 ~ 12V입니다.)<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://playground.arduino.cc/uploads/Learning/DCplug1.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://playground.arduino.cc/uploads/Learning/DCplug1.jpg" height="272" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">아두이노 보드에 아답터를 연결해서 사용할 수 있다.</td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://2.bp.blogspot.com/_Ap9EEd9K-fg/TS2uUrTehUI/AAAAAAAADeM/G8q7EIWJVms/image_thumb%5B2%5D.png?imgmax=800" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="240" src="https://2.bp.blogspot.com/_Ap9EEd9K-fg/TS2uUrTehUI/AAAAAAAADeM/G8q7EIWJVms/image_thumb%5B2%5D.png?imgmax=800" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">아두이노 보드에 배터리를 연결하여 사용할 수 있다.</td></tr>
</tbody></table>
<br />
아두이노 보드에서 사용되는 레귤레이터의 용량은 Uno 보드의 경우 제조사마다 다르지만 대략적으로 5W 정도됩니다. (5V 인가 시 최대 1A까지 사용할 수 있다는 뜻)<br />
만약, 10V 아답터를 사용했다면 0.5A까지 아두이노 보드에서 사용할 수 있다는 뜻입니다.<br />
따라서, 여러분은 아두이노 보드에 회로 구현 시 회로에서 사용되는 용량을 정확히 알고 이에 맞는 전원을 공급해야 문제없이 작동합니다.<br />
<br />
그렇다면, 어떤 것들이 많은 전류를 필요로 하는 부품일까요?<br />
주로 모터와 큰 조명 장치가 동작하는데 많은 전류를 필요로 합니다.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://s-media-cache-ak0.pinimg.com/736x/ca/e9/89/cae989e50defd2e8d160692b68a2834a.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="240" src="https://s-media-cache-ak0.pinimg.com/736x/ca/e9/89/cae989e50defd2e8d160692b68a2834a.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">큰 조명 장치는 큰 전류를 필요로 합니다.</td></tr>
</tbody></table>
<br />
만약, 아두이노 보드 용량을 넘어서는 전자 장치를 제어하고자 하는 경우 별도의 전원 공급 회로가 필요합니다. 아두이노 보드는 이런 회로를 사용할 수 있도록 Vin이라는 핀을 제공하는데, 여러분은 이 핀을 이용해서 여러분의 장치에 전원을 공급할 수 있습니다.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://i2.wp.com/www.forkrobotics.com/wp-content/uploads/2011/11/UNOpowerheaders.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://i2.wp.com/www.forkrobotics.com/wp-content/uploads/2011/11/UNOpowerheaders.jpg" height="320" width="190" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Vin 핀을 사용해서 큰 전류를 사용하는 장치를 제어할 수 있다.</td></tr>
</tbody></table>
<br />
물론, 아두이노 보드에 연결한 아답터의 용량이 연결된 모든 장치의 W를 커버할 수 있다는 전제하에 Vin 핀이 역할을 한다는 것을 기억해야 합니다.<br />
<br />
전원 공급이 문제없이 해결되었다면, 다음으로 해결해야 할 것은 외부 전원으로 구동되는 장치의 제어입니다.<br />
아두이노 보드는 Digital 혹은 PWM 핀을 사용해서 전자 장치를 제어할 수 있습니다. 문제는 별도의 전원으로 연결된 장치는 아두이노 핀을 제어에 사용할 수 없다는 것입니다.<br />
제어의 의미는 공급되는 전원을 On/Off시키는 것을 말하는데, 이미 별도의 전원을 사용하고 있는 장치는 아두이노 보드의 핀과 연결할 수 없기 때문입니다.<br />
이런 경우 사용하는 것이 바로 스위치(Switch)입니다. 스위치는 전원 공급을 On/Off시킬 수 있는 부품이며 사람이 직접 눌러서 제어할 수 있습니다.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcTEIWUtTleA2o7oH6ZzP3wUxFYcasYiW01y6pW48aX0mwJ5L22R" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="198" src="https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcTEIWUtTleA2o7oH6ZzP3wUxFYcasYiW01y6pW48aX0mwJ5L22R" width="200" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">스위치는 전기를 차단하거나 공급할 수 있다.</td></tr>
</tbody></table>
<br />
하지만, 스위치는 사람이 직접 제어하는 것이지 아두이노 보드가 할 수 있는 것이 아닙니다. 아두이노 보드가 전기를 차단하거나 공급하게 하려면 특별한 스위치가 필요한데, 이것을 바로 트랜지스터(Transistor)라 부릅니다.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://d1gsvnjtkwr6dd.cloudfront.net/large/SC-NPN-2N2222_LRG.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://d1gsvnjtkwr6dd.cloudfront.net/large/SC-NPN-2N2222_LRG.jpg" height="150" width="200" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">트랜지스터의 모습</td></tr>
</tbody></table>
<br />
트랜지스터는 핀이 3개있는데, 각각 Emitter, Base, Collector라 부릅니다.<br />
<ul>
<li>Collector: 외부 전원(+)에 연결</li>
<li>Base: 아두이노 보드 핀에 연결</li>
<li>Emitter: GND(-)에 연결</li>
</ul>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://upload.wikimedia.org/wikipedia/commons/thumb/f/f4/Diagrama_de_Transistor_NPN.svg/207px-Diagrama_de_Transistor_NPN.svg.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="200" src="https://upload.wikimedia.org/wikipedia/commons/thumb/f/f4/Diagrama_de_Transistor_NPN.svg/207px-Diagrama_de_Transistor_NPN.svg.png" width="184" /></a></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
트랜지스터를 사용하면 외부 전원으로 작동하는 전자 부품들을 제어할 수 있습니다. 트랜지스터도 당연히 용량이 있으므로 필요로 하는 용량에 맞게 사용해야 합니다.</div>
<div>
좀 큰 용량으로 사용되는 트랜지스터를 FET 혹은 MOSFET이라 부르며, 아주 큰 용량을 제어할 때는 릴레이(Relay)라 부르는 부품이 이 역할을 합니다.</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://cdn.sparkfun.com//assets/parts/4/5/5/5/10213-01.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="200" src="https://cdn.sparkfun.com//assets/parts/4/5/5/5/10213-01.jpg" width="200" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">MOSFET은 주로 방열판이 달려있다.</td></tr>
</tbody></table>
<div>
<br /></div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://cdn.shopify.com/s/files/1/0953/5270/products/02750001_00_2048x2048_crop_center.progressive.jpeg.jpg?v=1446834758" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="200" src="https://cdn.shopify.com/s/files/1/0953/5270/products/02750001_00_2048x2048_crop_center.progressive.jpeg.jpg?v=1446834758" width="200" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">릴레이는 큰 용량(Watt)를 제어할 수 있다.</td></tr>
</tbody></table>
<div>
<br /></div>
<div>
아두이노 보드에서 Digital 핀을 사용해서 제어하면 On/Off 제어가 가능하고 PWM 핀을 사용해서 제어하면 0V ~ 사용하는 전압까지 출력을 제어할 수 있습니다.</div>
<div>
<br /></div>
<div>
<br /></div>
Anonymoushttp://www.blogger.com/profile/10315630713623521810noreply@blogger.com2tag:blogger.com,1999:blog-2144160700871786133.post-48456028722664152452016-09-13T19:42:00.004+09:002016-09-28T15:53:14.286+09:00PlayMaker 소개유니티는 컴포넌트로 소프트웨어 제작에 필요한 기능을 제공합니다. 여러분은 이 컴포넌트 사용법을 잘 이해하고 적절한 곳에 사용함으로써 어플리케이션을 제작합니다.<br />
유니티가 기본으로 제공하는 컴포넌트는 메뉴를 통해 사용할 수 있습니다.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://cdn.tutsplus.com/active/uploads/legacy/tuts/285_unityPart2/tutorial/images/tree-capsule-collider.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="240" src="https://cdn.tutsplus.com/active/uploads/legacy/tuts/285_unityPart2/tutorial/images/tree-capsule-collider.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">유니티 컴포넌트 메뉴</td></tr>
</tbody></table>
<br />
기본 제공 컴포넌트는 매우 유용한 것이 많지만, 여러분의 어플리케이션을 제작하기에는 부족합니다.<br />
필요한 컴포넌트는 직접 만들어야 하는데, 유니티가 기본적으로 제시하는 컴포넌트 제작 방법은 C# 프로그래밍입니다.<br />
비전문가에게 프로그래밍은 쉽지 않은 도전입니다. 코딩없이 필요한 컴포넌트를 만들 수 있다면 매우 좋을 것입니다.<br />
이번에 제가 소개하는 PlayMaker는 바로 코딩없이 컴포넌트를 제작할 수 있는 에셋입니다.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://madlevelmanager.madpixelmachine.com/doc/2.2.5/integration/p/playmaker-logo.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://madlevelmanager.madpixelmachine.com/doc/2.2.5/integration/p/playmaker-logo.jpg" height="111" width="200" /></a></div>
<br />
PlayMaker는 유니티 에셋 스토어에서 구매할 수 있습니다. (<a href="https://www.assetstore.unity3d.com/?asac=8ZrCHu35oh#!/content/368" target="_blank">PlayMaker 바로가기</a>)<br />
PlayMaker는 유료로 판매되고 있지만, 그 가치는 매우 높기에 코딩없이 유니티를 사용하고자 하시는 분은 이 포스트를 보고 구매 여부를 판단해보시기 바랍니다.<br />
<br />
PlayMaker는 FSM(Finite State Machine)방식으로 프로그래밍합니다. FSM은 우리말로 유한 상태 머신이라고 부릅니다.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://www.oracle.com/ocom/groups/public/@otn/documents/digitalasset/144986.gif" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://www.oracle.com/ocom/groups/public/@otn/documents/digitalasset/144986.gif" height="290" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">FSM방식의 논리 표현 개념도</td></tr>
</tbody></table>
<br />
기존 대부분의 비주얼 프로그래밍 도구는 순서도(Flow Chart)방식이나 코드 블럭(Code Block)방식으로 표현했습니다.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://upload.wikimedia.org/wikipedia/commons/thumb/9/91/LampFlowchart.svg/2000px-LampFlowchart.svg.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="320" src="https://upload.wikimedia.org/wikipedia/commons/thumb/9/91/LampFlowchart.svg/2000px-LampFlowchart.svg.png" width="233" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">순서도 방식의 논리 표현 예</td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://cdn.hersam.com/images/2012/block-code.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://cdn.hersam.com/images/2012/block-code.png" height="312" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><span style="font-size: 12.8px;">코드 블럭방식의 논리 표현 예</span></td></tr>
</tbody></table>
<br />
간단한 논리는 이와 같은 방식이 괜찮을 수 있어도 논리가 복잡해지면 순서도나 코드 블럭 방식은 금방 표현의 한계를 드러내게 됩니다.<br />
반면에 FSM방식은 아무리 논리가 복잡해져도 어려움 없이 표현할 수 있습니다.<br />
<br />
PlayMaker에서 FSM 컴포넌트를 GameObject에 추가시키면 다음과 같은 모습이 됩니다.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://www.rustedgames.com/images/tutorials/ORKUnityAds/PlaymakerFSM.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://www.rustedgames.com/images/tutorials/ORKUnityAds/PlaymakerFSM.jpg" height="165" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">PlayMaker FSM 컴포넌트의 모습</td></tr>
</tbody></table>
<br />
여러분은 여기에다 필요한 논리를 구현하게 됩니다.<br />
FSM 컴포넌트를 편집하기 위해서는 PlayMaker에서 제공하는 FSM Editor를 사용합니다.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://mblogthumb3.phinf.naver.net/20150416_230/slee16_1429190383470qxhTB_JPEG/Lesson4_03b.jpg?type=w2" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://mblogthumb3.phinf.naver.net/20150416_230/slee16_1429190383470qxhTB_JPEG/Lesson4_03b.jpg?type=w2" height="185" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">PlayMaker FSM Editor</td></tr>
</tbody></table>
<br />
제일 먼저 해야 할 일은 상태(State)와 천이(Transition)를 정의하는 것입니다.<br />
State는 동작 상태를 의미하고 Transition은 각 상태 별로 이동하는 방법을 의미합니다.<br />
FSM Editor에서 State는 Box로 표현되고 Transition은 화살표로 표현됩니다.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcQ0gfB-7vD-xW5uFsYOLY8rwkyuOpAj9gi3bAqqiQ7xtuhXGZ9G" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="185" src="https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcQ0gfB-7vD-xW5uFsYOLY8rwkyuOpAj9gi3bAqqiQ7xtuhXGZ9G" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><span style="font-size: 12.8px;">PlayMaker State와 Transition 표현의 예</span></td></tr>
</tbody></table>
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
Transition은 발생 조건이 필요한데, 이것을 PlayMaker에서 이벤트(Event)라 부릅니다. 즉, 이벤트가 발생하면 Transition이 수행되어 현재 작동하는 State가 바뀐다는 뜻입니다.<br />
PlayMaker Event는 2가지 종류가 있습니다.<br />
<ul>
<li>Global Event: 어느 상황에서든 발생할 수 있는 이벤트</li>
<li>Local Event: 현재 State에서만 발생할 수 있는 이벤트</li>
</ul>
<div>
Global Event는 짙은 색 Box로 표현되고 Local Event는 옅은 색 Box로 표현됩니다.</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://hutonggames.fogbugz.com/default.asp?pg=pgDownload&pgType=pgWikiAttachment&ixAttachment=483&sFileName=FsmDiagram.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="320" src="https://hutonggames.fogbugz.com/default.asp?pg=pgDownload&pgType=pgWikiAttachment&ixAttachment=483&sFileName=FsmDiagram.png" width="300" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">1과 5는 Global Event<br />
2는 State<br />
3은 Local Event<br />
4는 Transition</td></tr>
</tbody></table>
<div>
<br /></div>
<div>
Event는 FSM Editor에서 여러분이 필요에따라 직접 만들 수 있습니다.</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFP98u4c4fl9KzF0wCnu9R8fyNYpXEtwbR8iKatHiKUk_8S3P6GMMcOVNK7ND4LgfwT4CBhJyFJJRlXnEu3r1RQYRwfiymIFNRrupt83eARayB41C20p1aybI8TcvQKUBwxeCC5dGGEac/s1600/PlayMaker+Event.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="275" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFP98u4c4fl9KzF0wCnu9R8fyNYpXEtwbR8iKatHiKUk_8S3P6GMMcOVNK7ND4LgfwT4CBhJyFJJRlXnEu3r1RQYRwfiymIFNRrupt83eARayB41C20p1aybI8TcvQKUBwxeCC5dGGEac/s320/PlayMaker+Event.png" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">PlayMaker Event 편집기</td></tr>
</tbody></table>
<br /></div>
<div>
State와 Transition을 이용해서 논리가 표현되었다면, 다음으로 할 일은 각 State에서 실제로 수행할 작업을 정의하는 것입니다.</div>
<div>
PlayMaker에서는 State에서 수행하는 작업을 Action이라 부릅니다.</div>
<div>
FSM Editor에서는 각 State별로 Action을 편집할 수 있습니다.</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://www.gamekakkak.com/wp-content/uploads/2015/12/manual10.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://www.gamekakkak.com/wp-content/uploads/2015/12/manual10.png" height="131" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">State에 추가된 Action의 모습</td></tr>
</tbody></table>
<div>
<br /></div>
<div>
Action들은 추가된 순서대로 실행되며 동작 방법을 설정할 수 있는 UI를 갖고 있습니다.</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://nuclearnapalm.com/wp-content/uploads/2015/06/CanvasGroupAction02.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://nuclearnapalm.com/wp-content/uploads/2015/06/CanvasGroupAction02.png" height="317" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">PlayMaker Action은 UI를 갖고 있다.</td></tr>
</tbody></table>
<div>
</div>
<div>
실제로 작업을 수행하는 것은 Action이기에 PlayMaker의 핵심은 이 Action을 얼마나 잘 활용하느냐입니다. PlayMaker는 갖고 있는 Action을 고르기 편하도록 Action Browser를 제공합니다.</div>
<div>
이 Action Browser에는 카테고리별로 잘 정리되어 있기때문에 필요한 Action을 쉽게 찾을 수 있습니다.</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://www.cnphp6.com/wp-content/uploads/article/2015-05-27/90161/16.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://www.cnphp6.com/wp-content/uploads/article/2015-05-27/90161/16.png" height="248" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">PlayMaker Action Browser</td></tr>
</tbody></table>
<div>
<br /></div>
<div>
PlayMaker는 Action간에 정보를 공유할 수 있도록 변수(Variable)를 만들 수 있습니다.</div>
<div>
FSM Editor에서 변수를 만들 수 있는 기능을 제공합니다.</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://i1308.photobucket.com/albums/s618/mark_davis18/PatrolRoute5_zpsersjbk9h.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://i1308.photobucket.com/albums/s618/mark_davis18/PatrolRoute5_zpsersjbk9h.png" height="320" width="233" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">FSM Editor의 변수 생성 기능</td></tr>
</tbody></table>
<div>
<br /></div>
<div>
PlayMaker Variable은 Event와 마찬가지로 Global과 Local로 공유의 범위를 정할 수 있습니다.</div>
<div>
<ul>
<li>Global Variable: 모든 FSM의 Action과 공유할 수 있다.</li>
<li>Local Variable: 속한 FSM내의 Action에서만 공유할 수 있다.</li>
</ul>
<div>
<br /></div>
</div>
<div>
PlayMaker FSM은 여러 개를 만들 수 있기에 하나의 FSM에 무리하게 복잡한 Logic을 표현하기보다 간단한 Logic을 여러 FSM에 나누어 표현하는 방식을 추천합니다.</div>
<div>
PlayMaker에서는 여러 FSM이 유기적으로 작동할 수 있도록 Event와 Variable을 공유할 수 있는 기능을 제공하므로 최신 소프트웨어 개발 기법인 객체 지향 프로그래밍(Object Oriented Programming)을 배울 수 있습니다.</div>
<div>
<br /></div>
<div>
아두니티는 PlayMaker를 완벽하게 지원하므로 PlayMaker를 사용해서 아두니티를 제어할 수 있습니다.</div>
<div>
PlayMaker에서 아두니티 활용법은 향후 자세히 다루겠습니다.</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj9aiE6ZcrgCfqQosgIXB7yXErsILubQTEU-2H1fb5Ndx1ey84cRjgzZRgfySTMkbsyVRoqc-dPDjWDfMBw-RbiwuMT6cWLM9PG-C6YPSv-bQkZE0y3rgdsfl1MBc3glU2sbapvS4JjM94/s1600/PlayMaker+Addon.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj9aiE6ZcrgCfqQosgIXB7yXErsILubQTEU-2H1fb5Ndx1ey84cRjgzZRgfySTMkbsyVRoqc-dPDjWDfMBw-RbiwuMT6cWLM9PG-C6YPSv-bQkZE0y3rgdsfl1MBc3glU2sbapvS4JjM94/s400/PlayMaker+Addon.png" width="203" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">ARDUnity PlayMaker Add-on을 설치하면 Action 카테고리가 생긴다.</td></tr>
</tbody></table>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
Anonymoushttp://www.blogger.com/profile/10315630713623521810noreply@blogger.com0tag:blogger.com,1999:blog-2144160700871786133.post-83720646727769799012016-09-13T16:59:00.001+09:002016-09-27T11:25:05.897+09:00메이커를 위한 혁신적인 도구 - 아두니티메이커(Maker)는 디지털 기기와 다양한 도구들을 활용하여 창의적인 만들기를 통해 자신의 아이디어를 실현하고 그것을 통해 얻은 지식과 노하우를 다른 사람들과 공유하는 사람들을 지칭합니다.<br />
이 말은 2005년 창간된 메이커 매거진을 통해 처음 언급되었고, 미국을 중심으로 시작된 메이커 운동(Maker Movement)으로 널리 확산되었습니다.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://www.inipro.net/upload/goods/c74226_Makev43_800x800_1024x1024.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://www.inipro.net/upload/goods/c74226_Makev43_800x800_1024x1024.jpg" height="200" width="200" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">메이커 매거진</td></tr>
</tbody></table>
<br />
메이커란 말이 있기 이전에 DIY(Do it yourself) 혹은 취미를 전문적으로 하는 사람들을 지칭하는 말이 있었습니다.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://static.rcgroups.net/forums/attachments/4/8/0/1/7/0/ai26745656-32-thumb-RC-Hobbies-and-More-2.jpg?d=1399480290" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://static.rcgroups.net/forums/attachments/4/8/0/1/7/0/ai26745656-32-thumb-RC-Hobbies-and-More-2.jpg?d=1399480290" height="208" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">RC 장비들을 판매하는 Shop</td></tr>
</tbody></table>
<br />
이런 행위들이 인터넷을 통한 UCC(User Created Contents)와 더불어서 개인적 차원의 활동이 사회적 영향력을 끼치게되었고, 이런 UCC들이 단순히 개인의 활동을 자랑하거나 소개하는 것을 넘어서 새로운 가치를 창출하여 사업화될 수 있음이 증명되고 있습니다.<br />
이런 이유로 메이커는 단순히 뭔가를 만드는 것을 넘어서 가치를 창출하고 수익을 낼 수 있는 새로운 직업의 형태로 자리잡고 있는 상황입니다.<br />
<br />
메이커들의 주 목적은 뭔가를 만드는 것입니다.<br />
만들기 위해서는 기술이 필요하고 기술을 습득하기 위해서는 지식을 얻고 훈련을 통해 숙련되어야 합니다.<br />
즉, 메이커가 되기 위해서는 숙련된 기술을 보유해야 됩니다.<br />
그래서, 예전의 DIY를 하는 사람들은 해당 분야를 전공해서 전문 기술을 보유하고 있거나 아주 많은 노력을 통해 필요한 기술을 보유하고 있었습니다.<br />
DIY관련 사업은 이런 특성을 잘 이해하고 기술 진입 장벽을 낮춰서 보다 더 많은 사람들이 DIY를 할 수 있도록 노력했습니다.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://pune.toplisting.in/wp-content/uploads/2015/05/000537.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://pune.toplisting.in/wp-content/uploads/2015/05/000537.jpg" height="240" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">DIY관련 도구와 부품들이 판매되고 있다.</td></tr>
</tbody></table>
<br />
메이커가 대중화되기 위해서는 만드는데 필요한 기술을 보다 쉽게 습득할 수 있도록 교육, 도구, 부품 등을 공급할 수 있는 관련 산업이 더불어 성장해야 합니다.<br />
<br />
<br />
만드는데 필요한 기술은 크게 3가지로 분류할 수 있습니다.<br />
<ul>
<li>외형 제작 기술</li>
<li>전자 하드웨어 제작 기술</li>
<li>제어 소프트웨어 개발 기술</li>
</ul>
<div>
외형을 제작하는 방법은 손으로 직접 그리거나 만드는 것에서부터 시작해서 가공 기계 등을 사용하는 것까지 매우 다양합니다.</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://previews.123rf.com/images/poznyakov/poznyakov1404/poznyakov140400212/27305126-Children-cutting-out-scissors-paper-in-preschool--Stock-Photo.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://previews.123rf.com/images/poznyakov/poznyakov1404/poznyakov140400212/27305126-Children-cutting-out-scissors-paper-in-preschool--Stock-Photo.jpg" height="254" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">미술 공작은 가장 기초적인 만들기 작업이다.</td></tr>
</tbody></table>
<div>
<br /></div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://www.woodworkersjournal.com/wp-content/uploads/IIEWT4.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://www.woodworkersjournal.com/wp-content/uploads/IIEWT4.jpg" height="248" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">전문 도구를 사용하면 더 잘 만들 수 있다.</td></tr>
</tbody></table>
<div>
<br /></div>
<div>
3D 프린터가 주목받는 이유는 컴퓨터로 그림을 그리면 그것을 그대로 만들어 줄 수 있기 때문입니다. 이 말은 외형 제작에 있어서 전문 가공 기술이 없어도 멋있는 결과물을 얻을 수 있다는 뜻입니다.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://www.allthat3d.com/wp-content/uploads/2016/08/3D-Printing-Trends.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="192" src="https://www.allthat3d.com/wp-content/uploads/2016/08/3D-Printing-Trends.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><span style="font-size: 12.8px;">3D 프린터는 외형 제작 방식에 혁신을 가져왔다.</span></td></tr>
</tbody></table>
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div>
<br /></div>
<div>
아직은 3D 프린터 활용과 보급에 있어서 제약이 많지만, 미래에는 모두 해결될 것이며 여러분은 숙련된 제작 기술이 없어도 훌륭한 품질의 외형을 만들 수 있게 될 것입니다.</div>
<div>
<br /></div>
<div>
<br /></div>
<div>
전자 하드웨어를 만들어야 하는 이유는 이제 만들어진 것이 전자적으로 작동 하는 것은 필수이기 때문입니다.</div>
<div>
전문가가 아닌 사람이 전자 하드웨어를 제작할 때 가장 어려운 점은 다음과 같습니다.</div>
<div>
<ul>
<li>필요한 부품을 구하기 어렵다.</li>
<li>각 부품을 다루는데 필요한 지식이 너무 전문적이다.</li>
</ul>
<div>
아두이노(Arduino)는 바로 이런 어려움을 해결해 줄 수 있기에 메이커들이 전자 하드웨어 제작 솔루션으로 가장 많이 사용하게 되었습니다.</div>
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://pbs.twimg.com/profile_images/378800000704356438/9d19310763171b0d958d23a18b3d7e1c_400x400.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="200" src="https://pbs.twimg.com/profile_images/378800000704356438/9d19310763171b0d958d23a18b3d7e1c_400x400.png" width="200" /></a></div>
<div>
<br /></div>
<div>
아두이노는 호환성이 매우 우수하기 때문에, 많은 관련 제품들이 있으며 온라인 Shop에서 부품을 판매하고 있습니다. 따라서, 인터넷 쇼핑을 통해 필요한 부품을 손쉽게 구매할 수 있습니다.</div>
<div>
또한, 전자 하드웨어 제작에 필요한 정보를 비 전문가 입장에서 쉽게 표현된 것을 인터넷에서 검색할 수 있습니다.</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://www.next.gr/uploads/26/arduino_h-bridge_schem.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://www.next.gr/uploads/26/arduino_h-bridge_schem.png" height="190" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">기존의 회로 표현 방식 (전문가용)</td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://www.forkrobotics.com/wp-content/uploads/2012/05/I2C-Relay_bb.png?189db0" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://www.forkrobotics.com/wp-content/uploads/2012/05/I2C-Relay_bb.png?189db0" height="132" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">아두이노 회로 표현 방식 (비전문가용)</td></tr>
</tbody></table>
<div>
<br /></div>
<div>
이와 같이 아두이노는 전자 하드웨어 제작에 있어서 획기적인 솔루션을 제공하였기에 이미 전세계적으로 수 많은 메이커들이 이 기술을 이용해서 만들기를 하고 있습니다.</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://www.nudatech.com/blog/wp-content/uploads/2013/01/inebriator.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://www.nudatech.com/blog/wp-content/uploads/2013/01/inebriator.jpg" height="225" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">전세계의 수많은 사람들이 아두이노로 만들고 있다.</td></tr>
</tbody></table>
<div>
<br /></div>
<div>
<br /></div>
<div>
마지막으로 남은 것은 제어 소프트웨어 개발 기술에 관한 내용입니다.</div>
<div>
이 부분이 아두니티와 매우 관련이 깊습니다.</div>
<div>
아두이노가 전자 하드웨어 제작을 아주 쉽게 할 수 있게 만들었지만, 그렇다고 아주 기능이 많은 복잡한 전자 하드웨어를 쉽게 만들 수 있는 것은 아닙니다.</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://enzondio.files.wordpress.com/2010/01/dsc_0039.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="212" src="https://enzondio.files.wordpress.com/2010/01/dsc_0039.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">요구되는 기능이 많을수록 아두이노도 매우 전문적인 기술이 필요하다.</td></tr>
</tbody></table>
<div>
<br /></div>
<div>
하지만, 메이커들의 아이디어는 매우 무궁무진하고 이것을 표현할 수 있는 방법은 필요합니다.</div>
<div>
이를 해결할 수 있는 가장 좋은 방법은 아두이노를 최대한 간단하게 만들고, PC나 스마트 폰에 연결해서 만드는 것입니다.</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://www.codeproject.com/KB/boards-embedded-devices/832835/1.1.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://www.codeproject.com/KB/boards-embedded-devices/832835/1.1.jpg" height="204" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">아두이노를 PC나 스마트 폰에 연결하는 개념</td></tr>
</tbody></table>
<div>
<br /></div>
<div>
이것을 하기 위해서는 PC나 스마트 폰에서 작동할 앱(App)을 만들어야 합니다.</div>
<div>
3D 프린터나 아두이노와 같이 메이커들을 위한 앱(App) 제작 솔루션이 있을까요?</div>
<div>
앞에서 언급했듯이 메이커는 해당 분야에 전문 기술을 보유하고 있지 않기에 보다 쉽게 할 수 있어야 합니다.</div>
<div>
메이커를 위한 앱(App) 제작 솔루션은 다음의 2가지를 충족해야 합니다.</div>
<div>
<ul>
<li>개발 방법이 최대한 쉬워야 한다.</li>
<li>아이디어를 표현할 수 있는 방법이 매우 다양해야 한다.</li>
</ul>
<div>
알려진 개발 방법이 쉬운 도구로는 스크래치(Scratch)와 앱 인벤터(App Inventor)가 있습니다.</div>
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://s-media-cache-ak0.pinimg.com/736x/7b/4b/5e/7b4b5ed6d08c663238c1ffeb68a92152.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="193" src="https://s-media-cache-ak0.pinimg.com/736x/7b/4b/5e/7b4b5ed6d08c663238c1ffeb68a92152.jpg" width="320" /></a></div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://i.ytimg.com/vi/rMyt0VUbkEc/maxresdefault.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="180" src="https://i.ytimg.com/vi/rMyt0VUbkEc/maxresdefault.jpg" width="320" /></a></div>
<div>
<br /></div>
<div>
스크래치와 앱 인벤터는 퍼즐을 맞추듯이 프로그래밍을 하기에 그 쉬운 방법으로 인해 초보자들에게 인기가 많습니다.</div>
<div>
하지만, 이것을 통해 할 수 있는 것이 많지 않아서 소프트웨어 개발 원리 등을 학습하는데는 적합하지만 아이디어를 구현하는데는 제약이 많습니다.</div>
<div>
따라서, 이 개발 도구는 결과의 다양성이란 부분을 충족하지 못합니다.</div>
<div>
<br /></div>
<div>
일부 메이커들은 기존의 소프트웨어 개발 도구를 자신의 아이디어를 구현하기 위해 사용하거나 그 기술을 습득하기 위해 노력하고 있습니다.</div>
<div>
<ul>
<li>Windows용 App은 Visual Studio를 사용합니다.</li>
<li>Android용 App은 Android Studio를 사용합니다.</li>
<li>Mac과 iOS(아이폰) App은 Xcode를 사용합니다.</li>
</ul>
<div>
이런 개발 도구들을 사용하면 매우 다양한 결과를 낼 수 있지만, 소프트웨어 개발을 위한 전문 도구이기 때문에 관련 전문 지식과 기술을 요구합니다.</div>
</div>
<div>
일부에서 Python, Swift등 기존보다 좀 더 쉬운 개발 방법 등을 제시하고 있지만, 여전히 근본적인 어려움을 넘지 못하고 있습니다.</div>
<div>
이런 도구들이 어려운 이유는 비주얼(Visual)하지 못하기 때문입니다.</div>
<div>
사람들은 이미지로 시각화하는 것을 좋아하며 자신의 아이디어를 가장 손쉽게 표현하는 것이 바로 그림입니다.</div>
<div>
대부분의 소프트웨어 개발 도구들은 Text방식으로 프로그래밍 언어를 사용하여 아이디어를 표현합니다.</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://docs.oracle.com/cd/E13167_01/aldsp/docs25/samples_tutorial/wwimages/figure7-2.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="228" src="https://docs.oracle.com/cd/E13167_01/aldsp/docs25/samples_tutorial/wwimages/figure7-2.gif" width="320" /></a></div>
<div>
<br /></div>
<div>
이것을 코딩이라 부르며 코딩에 익숙해져야 전문 개발 도구를 활용할 수 있습니다. 즉, 소프트웨어 개발을 위해 코딩이 필수가 아니라 소프트웨어 개발에 필요한 도구들이 코딩을 사용해서만 다룰 수 있다는 뜻입니다.</div>
<div>
코딩을 가르키느라 애쓸 것이 아니라 소프트웨어 개발 도구의 혁신을 가져와야 합니다.</div>
<div>
<br /></div>
<div>
<br /></div>
<div>
아두니티는 유니티를 소프트웨어 개발 도구로 선택했습니다.</div>
<div>
저는 유니티가 소프트웨어 개발 도구로써 혁신을 보여주었다고 생각합니다.</div>
<div>
이 부분은 현재 유니티가 전세계적으로 게임 업계의 약 70%이상을 점유하고 있는 것으로 증명할 수 있습니다.</div>
<div>
유니티가 나오기 전과 나온 후로 게임 업계의 인력 비율은 많은 변화가 있었습니다.</div>
<div>
<ul>
<li>유니티가 나오기 전에는 프로그래머의 비율이 매우 높았다.</li>
<li>유니티가 나온 이후는 그래픽 아티스트의 비율이 매우 높다.</li>
</ul>
<div>
이 말은 유니티로 인해 게임 개발 방식에 혁신이 이루어졌고, 그로 인해 전문 기술의 보유 보다는 창의적 아이디어가 더 중요해졌다는 뜻입니다.</div>
</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://farm7.static.flickr.com/6099/6209214780_6e31d7da88_b.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://farm7.static.flickr.com/6099/6209214780_6e31d7da88_b.jpg" height="218" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">유니티는 기존의 기술 중심에서 아트 중심으로 게임 개발 방법을 바꿨다.</td></tr>
</tbody></table>
<div>
<br /></div>
<div>
창의성 중심이란 말은 메이커와 매우 부합되기에 유니티는 메이커에게 많은 도움을 줄 수 있는 개발 도구가 될 수 있다는 뜻입니다.</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://e27.co/wp-content/uploads/2013/11/David-Helgason3.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="180" src="https://e27.co/wp-content/uploads/2013/11/David-Helgason3.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">유니티 CEO 데이비드 헬가슨</td></tr>
</tbody></table>
<div>
<br /></div>
<div>
유니티 CEO인 데이비드 헬가슨(David Helgason)은 유니티를 만든 목적에 대해 다음과 같이 말한 적이 있습니다.</div>
<div>
<br /></div>
<div>
<i>"우리는 소프트웨어를 아주 쉽게 만들 수 있는 도구를 만들고 싶었습니다. 게임은 소프트웨어 중 가장 복잡한 결과물입니다. 만약, 우리가 만든 도구가 게임을 쉽게 만들 수 있게 해준다면 그 목적을 이룰 수 있을 것이라 생각했습니다."</i></div>
<div>
<br /></div>
<div>
유니티는 단순히 게임을 만들기 위해 개발된 것이 아니라 소프트웨어 개발 방법에 혁신을 가져오고자 노력한 산물입니다.</div>
<div>
유니티는 개인 및 소규모 기업에게 무료로 배포하고 있는데, 이런 정책은 메이커 문화 확산에도 매우 긍정적인 영향을 주는 것입니다.</div>
<div>
<br /></div>
<div>
아두니티는 이런 훌륭한 소프트웨어 개발 도구를 메이커 솔루션으로 활용하고자 아두이노를 유니티에서 사용할 수 있도록 개발된 플러그인(Plug-In)입니다.</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://sites.google.com/site/ardunitydoc/_/rsrc/1460688555884/home/WhatARDUnity.png?height=120&width=400" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="120" src="https://sites.google.com/site/ardunitydoc/_/rsrc/1460688555884/home/WhatARDUnity.png?height=120&width=400" width="400" /></a></div>
<div>
<br /></div>
<div>
메이커들이 소프트웨어 개발 도구로써 아두니티를 선택한다면 보다 쉽고 창의적인 결과를 낼 수 있을 것이라 확신합니다.</div>
<div>
<br /></div>
<div>
<br /></div>
Anonymoushttp://www.blogger.com/profile/10315630713623521810noreply@blogger.com0tag:blogger.com,1999:blog-2144160700871786133.post-27822944778005956982016-09-12T20:47:00.000+09:002017-07-17T14:23:01.381+09:00유니티 2D유니티는 3D 게임을 쉽게 만들기 위한 목적으로 개발되었습니다. 그래서, 유니티의 기능은 3D 소프트웨어 제작이 용이하도록 만들어졌습니다.<br />
그러나, 실제로는 아직까지 2D 게임의 비율이 높으며 모바일 게임에서는 2D 게임의 비율이 훨씬 높습니다.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://2.bp.blogspot.com/BAmRFx07ObbqWSWczfDbqcg0Uc2HwnvlVBx9co607OjFWM2nYXk-NxiB6Mq2SwsLTww=h900" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="225" src="https://2.bp.blogspot.com/BAmRFx07ObbqWSWczfDbqcg0Uc2HwnvlVBx9co607OjFWM2nYXk-NxiB6Mq2SwsLTww=h900" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">2D 게임의 예</td></tr>
</tbody></table>
<br />
이로인해 많은 유니티 개발자들은 2D 게임을 개발했으며, 2D 게임 개발을 위한 기능을 유니티에 요구했습니다.<br />
이에 유니티는 버전 4.3부터 유니티 2D라는 이름으로 2D 게임 개발을 위한 기능을 기본적으로 내장하게 되었습니다.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://forum.unity3d.com/attachments/screenshot1-png.31197/" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://forum.unity3d.com/attachments/screenshot1-png.31197/" height="198" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">유니티 2D 기능</td></tr>
</tbody></table>
<br />
유니티 2D는 기존의 3D 편집 기능에 포함되는 방식으로 구현되었기에, 2D 및 3D 편집을 동시에 할 수 있습니다.<br />
유니티 프로젝트 생성 시에 2D / 3D를 선택할 수 있는데, 3D에서도 2D 편집을 할 수 있으므로 특별한 목적이 아니라면 3D로 설정할 것을 추천합니다.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEib0Bd7XRNzbwxcs490hDp3jlPsOFBz3k6JmpgncpCL2bohBcO7QcrZxZGjd0GdZcxGBU4BB43nCgkSqBUYaG27YCPaLED_kDY0Fa41551KGwx_8K_BwWScPd2vU5IBS4i1V6VnTUbPkcY/s1600/Unity_newProject.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" data-original-height="781" data-original-width="1600" height="195" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEib0Bd7XRNzbwxcs490hDp3jlPsOFBz3k6JmpgncpCL2bohBcO7QcrZxZGjd0GdZcxGBU4BB43nCgkSqBUYaG27YCPaLED_kDY0Fa41551KGwx_8K_BwWScPd2vU5IBS4i1V6VnTUbPkcY/s400/Unity_newProject.png" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">유니티 프로젝트 생성 시 2D / 3D 편집 방식을 선택할 수 있다.</td></tr>
</tbody></table>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
2D / 3D 편집 방식의 전환은 Scene Window에서 손쉽게 바꿀 수 있습니다.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://apprize.info/c/game_3/game_3.files/image103.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://apprize.info/c/game_3/game_3.files/image103.jpg" height="166" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Scene 윈도우의 2D 전환 버튼</td></tr>
</tbody></table>
2D로 바꾸면서 생기는 가장 큰 변화는 Z축이 사라진다는 것입니다. 사실은 Z축이 사라지는 것이 아니라 불필요하므로 안 보이게 됩니다.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://jessefreeman.com/wp-content/uploads/2014/08/unity-2d-workflow-Image85.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://jessefreeman.com/wp-content/uploads/2014/08/unity-2d-workflow-Image85.png" height="111" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">유니티 2D에서는 Z축이 보이지 않습니다.</td></tr>
</tbody></table>
<br />
2D로 바뀌면서 게임 오브젝트 위치 변경에 사용했던 Gizmo도 2D용을 사용할 수 있게 됩니다.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://docs.unity3d.com/uploads/Main/TransformGizmo35.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="122" src="https://docs.unity3d.com/uploads/Main/TransformGizmo35.png" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">3D용 Gizmo</td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://answers.unity3d.com/storage/temp/29446-screen+shot+2014-07-20+at+17.42.55.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://answers.unity3d.com/storage/temp/29446-screen+shot+2014-07-20+at+17.42.55.png" height="161" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">2D용 Gizmo</td></tr>
</tbody></table>
<br />
2D 편집 환경을 갖추기위해 빼먹지 말아야 할 것은 카메라 설정입니다. 카메라는 Scene의 모습을 Game Window에 보여주는 도구로써 사용자가 보는 화면을 만들어주는 역할을 합니다.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://docs.unity3d.com/kr/current/uploads/Main/InspectorCamera35.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://docs.unity3d.com/kr/current/uploads/Main/InspectorCamera35.png" width="269" /></a></div>
<br />
카메라 설정을 위해 Inspector Window에서 메뉴를 보면 Projection 설정이 있습니다.<br />
<br />
<ul>
<li>Perspective: 원근감있게 장면을 보여줌 (3D용)</li>
<li>Orthographic: 평면으로 장면을 보여줌 (2D용)</li>
</ul>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://i.stack.imgur.com/zyGF1.gif" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://i.stack.imgur.com/zyGF1.gif" height="178" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Perspective와 Orthographic의 차이점</td></tr>
</tbody></table>
<div>
<br /></div>
<div>
2D 전환 방법에 대해 <a href="https://unity3d.com/learn/tutorials/topics/2d-game-creation/2d-mode?playlist=17093" target="_blank">유니티 공식 튜토리얼 영상</a>을 참고하시기 바랍니다. </div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<b>Sprite</b></div>
<div>
3D에서는 Mesh와 Material을 이용해서 모델을 보여주었지만, 2D에서는 이미지로 모델을 보여주는데 이것을 Sprite라 부릅니다.</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://www.wyrmtale.com/images/unity3d/sprite-renderer.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://www.wyrmtale.com/images/unity3d/sprite-renderer.png" height="198" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Sprite Renderer</td></tr>
</tbody></table>
<div>
2D에서는 Sprite Renderer라는 컴포넌트가 화면에 이미지를 보여줍니다.</div>
<div>
Sprite Renderer의 활용에 대해서는 <a href="https://unity3d.com/learn/tutorials/topics/2d-game-creation/sprite-renderer?playlist=17093" target="_blank">유니티 공식 튜토리얼 영상</a>을 보기 바랍니다.</div>
<div>
<br /></div>
<div>
3D에서 이미지는 Texture라 불렸지만, 2D에서는 Sprite라 부르고 임포트 옵션이 다릅니다.</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://michaelcummings.net/Media/Default/Windows-Live-Writer/25a92b2c9b45_12215/image_10.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://michaelcummings.net/Media/Default/Windows-Live-Writer/25a92b2c9b45_12215/image_10.png" height="201" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">이미지를 2D용으로 사용하려면 Sprite로 선택해야 합니다.</td></tr>
</tbody></table>
<div>
<br /></div>
<div>
Sprite Editor를 사용하면 여러 그림이 포함된 것을 손쉽게 나눌 수 있습니다.</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://www.lindsaygcox.co.uk/wp-content/uploads/2014/06/SpriteEditor.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://www.lindsaygcox.co.uk/wp-content/uploads/2014/06/SpriteEditor.png" height="268" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">이미지 한 장에 포함된 여러 이미지 분할</td></tr>
</tbody></table>
<div>
<br /></div>
<div>
이 기능을 이용할 때 주의할 점은 반드시 이미지의 배경이 투명해야 한다는 것입니다. PNG타입의 이미지는 투명 배경을 지원하지만, JPG타입의 이미지는 투명 배경을 지원하지 않습니다.</div>
<div>
Sprite 설정에 대한 자세한 설명은 <a href="https://unity3d.com/learn/tutorials/topics/2d-game-creation/sprite-type?playlist=17093" target="_blank">유니티 공식 튜토리얼 영상</a>을 보기 바랍니다.</div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<b>2D Physics</b></div>
<div>
3D에서와 마찬가지로 2D에서도 물리 효과를 사용할 수 있습니다.</div>
<div>
유니티 공식 튜토리얼 영상을 통해 2D 물리 효과에 대해 알아보기 바랍니다.</div>
<div>
<ul>
<li><a href="https://unity3d.com/learn/tutorials/topics/2d-game-creation/2d-physics-overview?playlist=17093" target="_blank">2D Physics Overview</a></li>
<li><a href="https://unity3d.com/learn/tutorials/topics/2d-game-creation/rigidbody-2d?playlist=17093" target="_blank">Rigidbody 2D</a></li>
<li><a href="https://unity3d.com/learn/tutorials/topics/2d-game-creation/collider-2d?playlist=17093" target="_blank">Collider 2D</a></li>
<li><a href="https://unity3d.com/learn/tutorials/topics/2d-game-creation/hinge-joint-2d?playlist=17093" target="_blank">Hinge Joint 2D</a></li>
<li><a href="https://unity3d.com/learn/tutorials/topics/2d-game-creation/area-effector-2d?playlist=17093" target="_blank">Area Effector 2D</a></li>
<li><a href="https://unity3d.com/learn/tutorials/topics/2d-game-creation/distance-joint-2d?playlist=17093" target="_blank">Distance Joint 2D</a></li>
<li><a href="https://unity3d.com/learn/tutorials/topics/2d-game-creation/point-effector-2d?playlist=17093" target="_blank">Point Effector 2D</a></li>
<li><a href="https://unity3d.com/learn/tutorials/topics/2d-game-creation/bouncing-sliding-2d?playlist=17093" target="_blank">Bouncing & Sliding in 2D</a></li>
</ul>
<div>
<br /></div>
</div>
<div>
<b>2D Animation</b></div>
<div>
2D 애니메이션은 여러 장의 연속적인 이미지를 순차적으로 보여주는 것을 의미합니다. 유니티 2D는 이 방식의 애니메이션을 손쉽게 만들고 보여줄 수 있습니다.</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://cms-assets.tutsplus.com/uploads/users/262/posts/21364/image/ninja.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="270" src="https://cms-assets.tutsplus.com/uploads/users/262/posts/21364/image/ninja.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">애니메이션을 위해 연속 동작을 이미지로 만든 예</td></tr>
</tbody></table>
<div>
<br /></div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://www.iceboxstudios.co.uk/sites/default/files/7_8.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://www.iceboxstudios.co.uk/sites/default/files/7_8.png" height="71" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">유니티에서 이미지를 이용한 애니메이션을 손쉽게 만들 수 있다.</td></tr>
</tbody></table>
<div>
<br /></div>
<div>
또한, 관절방식의 애니메이션도 만들 수 있습니다.</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://cms-assets.tutsplus.com/uploads/users/262/posts/21364/image/02.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="172" src="https://cms-assets.tutsplus.com/uploads/users/262/posts/21364/image/02.png" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">관절 별로 나누어진 이미지 예</td></tr>
</tbody></table>
<div>
<br /></div>
<div>
<br /></div>
<div>
유니티 2D를 이용하면 Flash Animation이나 Game과 같은 컨텐츠를 쉽게 만들 수 있습니다.</div>
<div>
<br /></div>
Anonymoushttp://www.blogger.com/profile/10315630713623521810noreply@blogger.com0tag:blogger.com,1999:blog-2144160700871786133.post-51388968633412909792016-09-12T18:14:00.004+09:002017-09-24T16:22:49.542+09:00GenericMotor모터(Motor)는 전기를 이용해서 동력을 만들어내는 대표적 장치입니다.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://www.mind.ilstu.edu/curriculum/medical_robotics/dcmotor.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://www.mind.ilstu.edu/curriculum/medical_robotics/dcmotor.jpg" height="146" width="200" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
모터의 원리는 로렌츠 힘(Lorentz Force)에 의해 설명되는데, 자기장속에서 전류가 흐르면 힘이 발생한다는 것으로 이 힘이 모터를 돌리게 됩니다.</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://iwant2study.org/lookangejss/05electricitynmagnetism_21electromagnetism/ejss_model_LorentzForcewee01/LorentForce/left-hand-rule.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://iwant2study.org/lookangejss/05electricitynmagnetism_21electromagnetism/ejss_model_LorentzForcewee01/LorentForce/left-hand-rule.jpg" height="254" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">로렌츠의 힘을 설명하는 플라밍의 왼손 법칙</td></tr>
</tbody></table>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
모터는 작동 방식에 따라 여러가지로 분류될 수 있는데, 우리가 흔히 사용하는 모터는 DC 모터입니다.</div>
<div class="separator" style="clear: both; text-align: left;">
DC 모터는 다음과 같은 특성이 있습니다.</div>
<div class="separator" style="clear: both; text-align: left;">
</div>
<ul>
<li>DC 모터에 흐르는 전류의 세기에 따라 회전 속도가 달라진다.</li>
<li>DC 모터에 흐르는 전류의 방향에 따라 회전 방향이 달라진다.</li>
</ul>
<div>
DC 모터를 제어하는 가장 간단한 방법은 전류가 흐르도록 회로를 구성하는 것입니다.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgCxPBXNfg1dr4n-KX5XGsAEOTXBxARlY0SvdIqfH2ukfD_ffbJTBAd7OmeYtPXQoSFODD3LPyderRpEON_Y69AKK5VL8KRmqdbGcPTXrzOlPI1ccyowPDrHjm9aOVRG-MWASGl8SmUg0w/s1600/dcmotor_battery.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" data-original-height="627" data-original-width="1365" height="182" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgCxPBXNfg1dr4n-KX5XGsAEOTXBxARlY0SvdIqfH2ukfD_ffbJTBAd7OmeYtPXQoSFODD3LPyderRpEON_Y69AKK5VL8KRmqdbGcPTXrzOlPI1ccyowPDrHjm9aOVRG-MWASGl8SmUg0w/s400/dcmotor_battery.jpg" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">DC 모터를 배터리에 연결하면 바로 작동합니다.</td></tr>
</tbody></table>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div>
<br /></div>
<div>
DC 모터의 회전 속도를 조절하기 위해서는 전류를 조절해야 하는데, 옴의 법칙(Ohm's Law)에 따라 전압 혹은 저항을 통해 전류를 조절하여 DC 모터의 회전 속도를 제어할 수 있습니다.</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://upload.wikimedia.org/wikipedia/commons/thumb/a/a0/Ohms_law_voltage_source.svg/285px-Ohms_law_voltage_source.svg.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="146" src="https://upload.wikimedia.org/wikipedia/commons/thumb/a/a0/Ohms_law_voltage_source.svg/285px-Ohms_law_voltage_source.svg.png" width="200" /></a></div>
<div>
<br /></div>
<div>
문제는 DC 모터의 속도와 회전 방향을 아두이노 보드에서 제어하려면 좀 복잡한 회로가 필요합니다. DC 모터를 제어하는 대표적인 회로는 H-bridge 회로입니다.</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://www.robotoid.com/my-first-robot/images/motor-rev-bridge-concept.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://www.robotoid.com/my-first-robot/images/motor-rev-bridge-concept.png" height="248" width="400" /></a></div>
<div>
<br /></div>
<div>
스위치 역할을 하는 트랜지스터 4개를 이용해서 구현하는 회로로써 모양이 H와 같다고 하여 H-bridge 회로라 부릅니다.</div>
<div>
이 회로를 이용하면 DC 모터의 회전 속도와 방향을 아두이노 보드로 제어할 수 있습니다.</div>
<div>
H-bridge 회로를 구현하려면 좀 복잡하므로 Motor Driver IC를 많이 사용합니다.</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://products.li2.in/14-large_default/l293d-dual-dc-motor-driver-ic.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://products.li2.in/14-large_default/l293d-dual-dc-motor-driver-ic.jpg" height="200" width="200" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">대표적인 Motor Driver IC인 L293</td></tr>
</tbody></table>
<div>
<br /></div>
<div>
GenericMotor는 DC 모터를 제어하기 위한 H-bridge 회로를 유니티에서 다룰 수 있게 해주는 ArdunityController입니다.</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj0lIEBqb0VJ5a5VcYxGdCfmLS1YB1aDwn162xEIV7eFP4xnVHRmVNSh2k7xd2IUUoCBL9Z-Z2erYTkYUofFHjxH6OnDEMXRigijqF2JIYig6bQ9IcyLQ3x9A51Urw__yjHz5TmddOI6Xg/s1600/GenericMotor+Menu.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="85" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj0lIEBqb0VJ5a5VcYxGdCfmLS1YB1aDwn162xEIV7eFP4xnVHRmVNSh2k7xd2IUUoCBL9Z-Z2erYTkYUofFHjxH6OnDEMXRigijqF2JIYig6bQ9IcyLQ3x9A51Urw__yjHz5TmddOI6Xg/s400/GenericMotor+Menu.png" width="400" /></a></div>
<div>
<br /></div>
<div>
H-bridge 회로는 사용 방법에 따라 3가지 유형으로 나눌 수 있고, 각 유형에 따라 GenericMotor의 설정 방법이 달라지니 자신이 사용하는 방식이 어떤 것인지 잘 알고 있어야 합니다.</div>
<div>
<br /></div>
<div>
<b>1. One PWM & One Direction</b></div>
<div>
1개의 방향 제어용 Pin과 1개의 속도 제어용 Pin을 이용해서 H-bridge회로를 제어하는 유형입니다.</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://axotron.se/articles/H-Bridge/H-bridge_fig3_big.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://axotron.se/articles/H-Bridge/H-bridge_fig3_big.png" height="186" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">One PWM & One Direction으로 제어되는 H-bridge</td></tr>
</tbody></table>
<div>
<br /></div>
<div>
아두이노 모터 쉴드가 대표적으로 이 방법을 사용합니다.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhFpTkXR_XhwNMqpLprXXVDOdybWUKdcnbh5P_dkdjVUVa8RJSEzPfMP5Fs5hPOyJFjXjVT8V7rXm0i9UdU4XDL_e1Zl6CD3oNBOB8ByFbS4Ar4O5O_g3XquTqLddnKIZedFZVss17tBvo/s1600/arduino_motorshield.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" data-original-height="300" data-original-width="385" height="249" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhFpTkXR_XhwNMqpLprXXVDOdybWUKdcnbh5P_dkdjVUVa8RJSEzPfMP5Fs5hPOyJFjXjVT8V7rXm0i9UdU4XDL_e1Zl6CD3oNBOB8ByFbS4Ar4O5O_g3XquTqLddnKIZedFZVss17tBvo/s320/arduino_motorshield.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">아두이노 모터 쉴드</td></tr>
</tbody></table>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhQnLzOIBz7tpXkz2K5LvaXUG3Ns5mqxUNkxHJ43gMtBWCDkonm0BczXwAcbIxWk6yQzmLZAxkafFPXTTxouj4F7bmg7275xtlwqBKjr3by-y8Nlv2R-Dl8u4e95t8AKh8exDv44ZIynnE/s1600/GenericMotor+Block1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="200" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhQnLzOIBz7tpXkz2K5LvaXUG3Ns5mqxUNkxHJ43gMtBWCDkonm0BczXwAcbIxWk6yQzmLZAxkafFPXTTxouj4F7bmg7275xtlwqBKjr3by-y8Nlv2R-Dl8u4e95t8AKh8exDv44ZIynnE/s200/GenericMotor+Block1.png" width="141" /></a></div>
<div>
<br /></div>
<div>
이 경우 GenericMotor의 설정은 다음과 같습니다.</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgK8fd99wye_TwApQDHhd3GGgnBHAbG3Z8z0gcLhSzy1Rfe7sGzYf-MmEirLWFbstwYaG_04pr-66twz881hIWHp2iKF8DeWvFmt7Xdcya4H0VgEwKJO__jwfqyiLIXVen7Mj_FyUtTLPY/s1600/GenericMotor+Inspector1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="220" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgK8fd99wye_TwApQDHhd3GGgnBHAbG3Z8z0gcLhSzy1Rfe7sGzYf-MmEirLWFbstwYaG_04pr-66twz881hIWHp2iKF8DeWvFmt7Xdcya4H0VgEwKJO__jwfqyiLIXVen7Mj_FyUtTLPY/s320/GenericMotor+Inspector1.png" width="320" /></a></div>
<div>
<ul>
<li>id: ArdunityApp이 ArdunityController를 구별하기 위한 식별자</li>
<li>controlType: H-bridge 제어 유형 선택</li>
<li>dir Pin: 방향 제어로 사용되는 Pin 번호</li>
<li>pwm Pin: 속도 제어로 사용되는 PWM Pin 번호</li>
</ul>
<div>
<br /></div>
</div>
<div>
<b>2. Two PWM</b></div>
<div>
2개의 PWM 핀을 이용해서 H-bridge 회로를 제어하는 유형입니다.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEha3vLP2s-ougsUAvXhN2BA3h-NYNHyeqpj5MApOI2-gjrZMZhRY2aRfahxNgT3Qg43sHhY_u0BHL2QL3s-rIpBxEf2rZDRgb6zVGhyvK_50JA3H9bbCBa7RRl-HWbLyQn-1q_Whsm2PN8/s1600/two_pwm.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" data-original-height="250" data-original-width="590" height="168" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEha3vLP2s-ougsUAvXhN2BA3h-NYNHyeqpj5MApOI2-gjrZMZhRY2aRfahxNgT3Qg43sHhY_u0BHL2QL3s-rIpBxEf2rZDRgb6zVGhyvK_50JA3H9bbCBa7RRl-HWbLyQn-1q_Whsm2PN8/s400/two_pwm.png" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">2개의 PWM신호로 제어되는 H-bridge 회로</td></tr>
</tbody></table>
<br /></div>
<div>
L298이라는 Motor Driver IC가 이 방식을 사용합니다.</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://upload.wikimedia.org/wikipedia/commons/2/23/L298_IMGP4533_wp.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="151" src="https://upload.wikimedia.org/wikipedia/commons/2/23/L298_IMGP4533_wp.jpg" width="200" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">L298 Motor Driver IC</td></tr>
</tbody></table>
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjSVPrquZ34BgNMwNK1DnDDBdYwmJjlQx2keQrJ58Rrsh9243IaaUhrphZX6ip14UrLJQK9l5a7-P7Xvk8kJceCsren3Ej80BmxewGu1XEkFU_N1xCRQ6P7fWeeUZkReFg13RgK-xc1_OM/s1600/GenericMotor+Block2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="200" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjSVPrquZ34BgNMwNK1DnDDBdYwmJjlQx2keQrJ58Rrsh9243IaaUhrphZX6ip14UrLJQK9l5a7-P7Xvk8kJceCsren3Ej80BmxewGu1XEkFU_N1xCRQ6P7fWeeUZkReFg13RgK-xc1_OM/s200/GenericMotor+Block2.png" width="142" /></a></div>
<div>
<br /></div>
<div>
이 경우 GenericMotor의 설정은 다음과 같습니다.</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgdMUNjXY3PvZ9_-L5ZfimDtLIhUA-E5Un0hDwIVcgnDJjaJ626BRrOxum_aOEEJzM_fEo8hLbNusw08tD1-1Om89KFndliXJ1Az-uHWS98TzXYwzut35QRZBqvkpU3ppULKTvL8bu54uA/s1600/GenericMotor+Inspector2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="216" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgdMUNjXY3PvZ9_-L5ZfimDtLIhUA-E5Un0hDwIVcgnDJjaJ626BRrOxum_aOEEJzM_fEo8hLbNusw08tD1-1Om89KFndliXJ1Az-uHWS98TzXYwzut35QRZBqvkpU3ppULKTvL8bu54uA/s320/GenericMotor+Inspector2.png" width="320" /></a></div>
<div>
<ul>
<li>F pwm Pin: 정회전 속도 제어용 PWM 핀 번호</li>
<li>B pwm Pin: 역회전 속도 제어용 PWM 핀 번호</li>
</ul>
<div>
<br /></div>
</div>
<div>
<b>3. One PWM & Two Direction</b></div>
<div>
회전 방향 제어를 위해 2개의 핀이 사용되고, 속도 제어를 위해 1개의 핀이 사용되는 방식입니다.</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://nathandumont.com/files/images/hbridge_logic_enable.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://nathandumont.com/files/images/hbridge_logic_enable.png" height="322" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">One PWM & Two Direction으로 제어되는 H-bridge</td></tr>
</tbody></table>
<div>
<br /></div>
<div>
L293이라는 Motor Driver IC가 이 방식을 사용합니다.</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://www.ti.com/graphics/folders/partimages/L293.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://www.ti.com/graphics/folders/partimages/L293.jpg" height="116" width="200" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">L293 Motor Driver IC</td></tr>
</tbody></table>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhTgbsUCA5hpqQcziF4OeBpfXHVIbyuk9u9IIpoLz-C-arRsbKhTRnk2N3c36bi_K6r6MYc2jnjWoFrz9HETAw4m6WsafzuHh6OdhOxL0RXuB4JS5TbWnGRM8XUagPGnXf8WTyECsw-3Ag/s1600/GenericMotor+Block3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="200" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhTgbsUCA5hpqQcziF4OeBpfXHVIbyuk9u9IIpoLz-C-arRsbKhTRnk2N3c36bi_K6r6MYc2jnjWoFrz9HETAw4m6WsafzuHh6OdhOxL0RXuB4JS5TbWnGRM8XUagPGnXf8WTyECsw-3Ag/s200/GenericMotor+Block3.png" width="128" /></a></div>
<div>
<br /></div>
<div>
이 경우 GenericMotor는 다음과 같이 설정합니다.</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjn2fy8GxOS0lDI9B2wB8a6apvZwI3ZOdkxWoejqUg4j0gQ-e6ZPj2qgfTt9riz_fYBzndKDCvAKprN1Or3Wp16_MpIDDe5gXi1OrcKnPYptbDbs0QqpAoYS6nOkOAoLF77vX782CwelsA/s1600/GenericMotor+Inspector3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="237" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjn2fy8GxOS0lDI9B2wB8a6apvZwI3ZOdkxWoejqUg4j0gQ-e6ZPj2qgfTt9riz_fYBzndKDCvAKprN1Or3Wp16_MpIDDe5gXi1OrcKnPYptbDbs0QqpAoYS6nOkOAoLF77vX782CwelsA/s320/GenericMotor+Inspector3.png" width="320" /></a></div>
<div>
<ul>
<li>pwm Pin: 속도 제어에 사용되는 PWM 핀 번호</li>
<li>F dir Pin: 정회전 설정에 사용되는 핀 번호</li>
<li>B dir Pin: 역회전 설정에 사용되는 핀 번호</li>
</ul>
<div>
<br /></div>
</div>
<div>
H-bridge 제어 유형별로 Sketch Option 설정을 마쳤다면 다음과 같이 Wire Editor에서 연결하고 아두이노 스케치를 Export & Upload하면 유니티에서 회로를 테스트할 수 있습니다.</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfGIXf6nB92lerdiMrcBQY-KvA_7qJovjgFiOIA6DFoXI9xfnKRuYXAgo73Psc6KO51FaIOThR2e9CY4m8_7yg580nPRx3tiXL6Fhfr3uMNF-Xx3FvTX4aznryJA72Spa-DjoJquDcgok/s1600/GenericMotor+Wiring.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="150" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfGIXf6nB92lerdiMrcBQY-KvA_7qJovjgFiOIA6DFoXI9xfnKRuYXAgo73Psc6KO51FaIOThR2e9CY4m8_7yg580nPRx3tiXL6Fhfr3uMNF-Xx3FvTX4aznryJA72Spa-DjoJquDcgok/s400/GenericMotor+Wiring.png" width="400" /></a></div>
<div>
<br /></div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiGIW-hzsc6ppg2sRm0_2hZK90F3pq3MiNI_vOf3nbCiWmt7rNZ8_dQV4lyaZXEzMVrHaaqf8g3Mx-YTG6GDe7h9KPsMCwTggnSWV6-n8OIL2pto6D4IGn3aGE0vsbKzSm_fqVvpj3kjXs/s1600/GenericMotor+Inspector4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="135" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiGIW-hzsc6ppg2sRm0_2hZK90F3pq3MiNI_vOf3nbCiWmt7rNZ8_dQV4lyaZXEzMVrHaaqf8g3Mx-YTG6GDe7h9KPsMCwTggnSWV6-n8OIL2pto6D4IGn3aGE0vsbKzSm_fqVvpj3kjXs/s320/GenericMotor+Inspector4.png" width="320" /></a></div>
<div>
<ul>
<li>punchValue: 모터에 걸린 부하로 인해 제어되지 않는 값의 구간을 없애준다.</li>
<li>Value: 모터 제어 값 (범위 -1 ~ 1)</li>
<ul>
<li>+1: 정방향 최대 속도</li>
<li>0: 정지</li>
<li>-1: 역방향 최대 속도</li>
</ul>
<li>Stop: Value를 0으로 만들어 줌</li>
</ul>
<div>
punchValue는 Value의 값이 모터를 회전시키기에 부족한 출력을 낼때 모터에서 소리가 나는 것을 방지해주는 값입니다. Value는 punchValue에 의해 아래와 같은 출력 곡선을 만들게 됩니다.</div>
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEja5nmx7N-dFmtpp-OjqiVqhkcPlvu6xxFVVPOZnmujVMBmyVSh0NzKKMJem6-utjdpqTeDd_z84ueIJqYC7P8X6r1s_a2GBh4xeOgaYDUJDaEeqXTw3afmmspaNVBBkByWAd53uws84AU/s1600/punch+Value.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="278" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEja5nmx7N-dFmtpp-OjqiVqhkcPlvu6xxFVVPOZnmujVMBmyVSh0NzKKMJem6-utjdpqTeDd_z84ueIJqYC7P8X6r1s_a2GBh4xeOgaYDUJDaEeqXTw3afmmspaNVBBkByWAd53uws84AU/s400/punch+Value.png" width="400" /></a></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
C# Script로 GenericMotor를 제어하는 방법은 다음과 같습니다.</div>
<div>
(본 예제는 보드 연결 시 DC 모터를 최저 속도에서 최고 속도까지 정회전과 역회전을 반복합니다.)</div>
<pre><code class="language-csharp">
using UnityEngine;
using System.Collections;
using Ardunity;
public class MyComponent : MonoBehaviour
{
public GenericMotor motor;
private bool _toggle = true;
private float _value;
void Start ()
{
_value = motor.Value;
}
void Update ()
{
if(motor.connected)
{
if(_toggle == true)
{
_value += 0.001f;
if(_value >= 1f)
{
_value = 1f;
_toggle = false;
}
}
else
{
_value -= 0.001f;
if(_value <= -1f)
{
_value = -1f;
_toggle = true;
}
}
motor.Value = _value;
}
}
}
</code>
</pre>
Anonymoushttp://www.blogger.com/profile/10315630713623521810noreply@blogger.com2tag:blogger.com,1999:blog-2144160700871786133.post-29458813988451669692016-09-05T14:24:00.001+09:002016-09-05T14:24:52.451+09:00RC 서보 모터 다루기RC 서보 모터는 주로 RC 자동차의 조향 장치에 활용되는 부품입니다. 이것은 값이 싸고 손쉽게 구할 수 있습니다.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://www.tetrixrobotics.com/sharedimages/product/icongo/iCg_39197_180degServo.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://www.tetrixrobotics.com/sharedimages/product/icongo/iCg_39197_180degServo.jpg" height="200" width="200" /></a></div>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://cdn.instructables.com/FZ1/UZW4/F1SVO9DC/FZ1UZW4F1SVO9DC.LARGE.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="240" src="https://cdn.instructables.com/FZ1/UZW4/F1SVO9DC/FZ1UZW4F1SVO9DC.LARGE.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">RC 자동차 조향 장치에 서보 모터가 사용된 모습</td></tr>
</tbody></table>
<br />
서보 모터를 아두이노에서 사용하기 위한 회로는 다음과 같습니다.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiziKH5R9C10G3FqvyV5B5hND8v45kynSlX9CT-EiqQ9_1KCf9GYqimUoZN3QWnzdbjBFuGoT7_cbSGAY1CdDgM9sq9ej0BfqYm2KCQSRdw-RC-rHeLggTNRWlSREzzrA_Xp2a4Egox6wE/s1600/ServoMotor+Circuit.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="251" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiziKH5R9C10G3FqvyV5B5hND8v45kynSlX9CT-EiqQ9_1KCf9GYqimUoZN3QWnzdbjBFuGoT7_cbSGAY1CdDgM9sq9ej0BfqYm2KCQSRdw-RC-rHeLggTNRWlSREzzrA_Xp2a4Egox6wE/s400/ServoMotor+Circuit.png" width="400" /></a></div>
<br />
서보 모터는 3개의 선을 연결하도록 되어있는데, 제조사 별로 케이블의 색깔만 다를 뿐 각각의 역할은 같습니다.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgh322OUXk0V-ws56EGmXi1VLqm8wHKTaM3jvlr_mYMPrwwIdOsy6B7j9dC7y5gcB3aET3hvp2e84Slukt0EwpC0fztmjR00ydgR86SfRvO_TSxOI4e6ZgtVG_tn8QJfxTHTPzEQIXumF0/s1600/servo+pinout.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgh322OUXk0V-ws56EGmXi1VLqm8wHKTaM3jvlr_mYMPrwwIdOsy6B7j9dC7y5gcB3aET3hvp2e84Slukt0EwpC0fztmjR00ydgR86SfRvO_TSxOI4e6ZgtVG_tn8QJfxTHTPzEQIXumF0/s1600/servo+pinout.png" height="273" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">제조사 별 서보 모터 연결 규격</td></tr>
</tbody></table>
<br />
<ul>
<li>전원선: (+)극을 의미하고 전원을 공급하며 5 ~ 7V 정도가 일반적입니다.</li>
<li>접지선: (-)극을 의미합니다.</li>
<li>신호선: 서보 모터 제어를 위한 PWM 신호 선입니다.</li>
</ul>
<div>
<br /></div>
<div>
아두이노 보드에서 모터를 다룰 때 주의할 점은 전원 공급입니다. 모터는 작동하기 위해서 생각보다 큰 전류를 소모합니다. 모터에 걸리는 부하(Load)에 따라서 소모되는 전류의 크기는 다릅니다.</div>
<div>
아두이노 보드는 PC의 USB에 연결하여 주로 사용하는데, 전원 공급을 USB를 통해 받게됩니다. PC의 USB는 사양에 따라 다르지만, 5V에 최대 200mA까지 사용할 수 있습니다.</div>
<div>
PC의 USB 전원으로 서보 모터를 구동하게 되면 전원 공급 부족으로 작동이 안 될 수 있고, 잘못하면 PC의 USB에 무리를 주어 포트가 망가질 수도 있습니다.</div>
<div>
1개 정도를 부하 없이(No Load) 테스트 목적으로 사용한다면 괜찮지만, 구조물을 연결하여 제어할 때는 외부 전원을 연결하여 사용하는 것이 좋습니다.</div>
<div>
아두이노 보드는 아답터나 건전지 등으로 외부 전원을 연결하여 사용할 수 있습니다.</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://playground.arduino.cc/uploads/Learning/DCplug1.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://playground.arduino.cc/uploads/Learning/DCplug1.jpg" height="272" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">아답터를 연결하여 사용하는 모습</td></tr>
</tbody></table>
<div>
<br /></div>
<div>
서보 모터 회로를 유니티에서 사용하려면 Wire Editor를 이용해서 다음과 같이 연결합니다.</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFWPpJIgFxDbDTBSUAkw4QjTHrduLCxvBKe7VjVLIejunleOhHzWqenMBLRnXwFEYtEYNlDpPsQEn7PbwYOtX4yYCEjM4NL3SbrXqUXeOw2nHXReLMXhCtjuIPqWKRdIqxgRaHkN8jur8/s400/GenericServo+Wiring.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="146" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFWPpJIgFxDbDTBSUAkw4QjTHrduLCxvBKe7VjVLIejunleOhHzWqenMBLRnXwFEYtEYNlDpPsQEn7PbwYOtX4yYCEjM4NL3SbrXqUXeOw2nHXReLMXhCtjuIPqWKRdIqxgRaHkN8jur8/s400/GenericServo+Wiring.png" width="400" /></a></div>
<div>
<br /></div>
<div>
이것을 아두이노 스케치로 Export한 후, 유니티와 연결하면 GenericServo의 Angle값을 변경함으로써 서보 모터가 움직이는 것을 확인할 수 있습니다.</div>
<div>
<br /></div>
<div>
<b>RC 자동차 핸들 만들기</b></div>
<div>
유니티 UI를 이용해서 RC 자동차의 조향 제어를 할 수 있는 핸들을 만들어 볼 수 있습니다.</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://i.ytimg.com/vi/7PiEuGQFlBY/maxresdefault.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="180" src="https://i.ytimg.com/vi/7PiEuGQFlBY/maxresdefault.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">레이싱 게임의 조종 핸들의 모습</td></tr>
</tbody></table>
<div>
<br /></div>
<div>
레이싱 게임에는 조향 제어를 할 수 있는 핸들 UI가 있습니다. 이것을 유니티에서도 구현할 수 있는데, 안타깝게도 기본 기능이 아니어서 사용자가 만들어야 합니다.</div>
<div>
아두니티는 이렇게 필요하지만, 유니티가 제공해주지 않는 기능을 유틸리티(Utility)란 이름으로 제공합니다.</div>
<div>
핸들 UI로 유용하게 사용할 수 있는 컴포넌트는 바로 DialSlider입니다. DialSlider는 유니티 UI에서 작동하기 때문에 반드시 유니티 캔버스(Canvas)에 존재해야 합니다.</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi3myMEKRdJlHKhpnpdIYTasEJM86zmMDSmuwG16s2sLQx9C9rsCv4ACMRUP6XjEZEfQYWQ3pbafZ8eOINLsVMPQ8HqPzmaQDWJkmA1sqJUC9Yr_8dC2PEbtyHBUxZ7yJkWJlDJXR176hU/s1600/DialSlider+Menu.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="176" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi3myMEKRdJlHKhpnpdIYTasEJM86zmMDSmuwG16s2sLQx9C9rsCv4ACMRUP6XjEZEfQYWQ3pbafZ8eOINLsVMPQ8HqPzmaQDWJkmA1sqJUC9Yr_8dC2PEbtyHBUxZ7yJkWJlDJXR176hU/s400/DialSlider+Menu.png" width="400" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhcfS22_GTxsfhDLILGmjtWzNNVefZqSz9WgNLemRq1LuFV283RFtOXG6a-fve12Ht7sEIEKbFQ53GP2eTE_cHn6TJOXavpbJq2uMtVIJ6fOu072MpKXAYjchw8sb0iXH8JAOrlhWcXzk4/s1600/DialSlider+Inspector.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhcfS22_GTxsfhDLILGmjtWzNNVefZqSz9WgNLemRq1LuFV283RFtOXG6a-fve12Ht7sEIEKbFQ53GP2eTE_cHn6TJOXavpbJq2uMtVIJ6fOu072MpKXAYjchw8sb0iXH8JAOrlhWcXzk4/s320/DialSlider+Inspector.png" width="261" /></a></div>
<div>
<ul>
<li>knob: 핸들이 돌려지는 것을 표현할 이미지</li>
<li>minAngle: 핸들 최소 각도</li>
<li>maxAngle: 핸들 최대 각도</li>
<li>interactable: 입력 활성/비 활성</li>
<li>sprint: 손을 떼었을 때 중앙으로 되돌아오는 옵션</li>
<li>Angle: 핸들의 회전 각도</li>
<li>OnDragStart: 핸들 조작이 시작되는 이벤트</li>
<li>OnDragEnd: 핸들 조작이 완료되는 이벤트</li>
</ul>
<div>
DialSlider를 서보 모터 제어에 사용하려면 DialSliderReactor가 필요합니다.</div>
</div>
<div>
DialSliderReactor는 DialSlider의 Angle값을 서보 모터에 전달해주는 역할을 합니다.</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh4jjEhSxLv-PdPO1ahWNwzdCPJZh5CqEo80vEuHw2KKORagOEIYddKztsZBGkHCcFBUjcYM1fEjnzuNakCnwUQN_IT39Ul2X6NRwvRf_PlaBd-qqYRWGSp5VM_Xjur9mJQewBOsaX2fxc/s1600/DialSliderReactor+Menu.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="132" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh4jjEhSxLv-PdPO1ahWNwzdCPJZh5CqEo80vEuHw2KKORagOEIYddKztsZBGkHCcFBUjcYM1fEjnzuNakCnwUQN_IT39Ul2X6NRwvRf_PlaBd-qqYRWGSp5VM_Xjur9mJQewBOsaX2fxc/s400/DialSliderReactor+Menu.png" width="400" /></a></div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_1GJNAUroo6SbAqCT2RvB7_Y5HL2nA7Lv-OebWuETAsY2hBxGTMsHSszJdZ1nwiIS7IlRvAYnDxTRilccli-j_D7BRPRlYHhQBaGklPo9qQDGjNIByMza1fGUUbZp6LZznyMgQcZDAms/s1600/DialSliderReactor+Block.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="132" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_1GJNAUroo6SbAqCT2RvB7_Y5HL2nA7Lv-OebWuETAsY2hBxGTMsHSszJdZ1nwiIS7IlRvAYnDxTRilccli-j_D7BRPRlYHhQBaGklPo9qQDGjNIByMza1fGUUbZp6LZznyMgQcZDAms/s200/DialSliderReactor+Block.png" width="200" /></a></div>
<div>
<br /></div>
<div>
DialSliderReactor의 설정은 다음과 같습니다.</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-GswOJi9_fR7iZWy1VZ5L0_cThFtOMaOkzn80YIqqjlt1PzzQO8LT_gIX453T3hWC7wG67BxqGORHPohmPcT63x-C5O0cj9lKbUhtBhHa9Rxy58Q-fBRj3bXLsh7VAMtwZxG4TxmhdLE/s1600/DialSliderReactor+Inspector.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="77" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-GswOJi9_fR7iZWy1VZ5L0_cThFtOMaOkzn80YIqqjlt1PzzQO8LT_gIX453T3hWC7wG67BxqGORHPohmPcT63x-C5O0cj9lKbUhtBhHa9Rxy58Q-fBRj3bXLsh7VAMtwZxG4TxmhdLE/s320/DialSliderReactor+Inspector.png" width="320" /></a></div>
<div>
<ul>
<li>Invert: DialSlider의 핸들 방향과 반대로 출력</li>
</ul>
<div>
GenericServo와 다음과 같이 연결하면 DialSlider로 서보 모터 제어가 가능해집니다.</div>
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh5LKkMPVOr6-aQaSlhqdNlaCIjjFkrUW4fxOF6Ap8NNJBb82RobKqDSLzfv8C6C3OJihMgBDASqazBsim5ryblkPh_cg8FOkktCxOjE46DANEwv2rV26T2nANH6ssX7IHUd9IBnTM9Jek/s1600/DialSliderReactor+Wiring.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="170" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh5LKkMPVOr6-aQaSlhqdNlaCIjjFkrUW4fxOF6Ap8NNJBb82RobKqDSLzfv8C6C3OJihMgBDASqazBsim5ryblkPh_cg8FOkktCxOjE46DANEwv2rV26T2nANH6ssX7IHUd9IBnTM9Jek/s320/DialSliderReactor+Wiring.png" width="320" /></a></div>
<div>
<br /></div>
<div>
<b>로봇 제어</b></div>
<div>
당신이 만약 서보 모터로 로봇을 만들었다면 유니티로 로봇을 제어할 수 있습니다.</div>
<div>
로봇 제어를 위해 먼저 해야 할 일은 3D 물체의 회전과 서보 모터 각도를 일치시키는 것입니다.</div>
<div>
RotationAxisReactor를 이용하면 이 작업을 매우 쉽게 할 수 있습니다.</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiXNtg3ycFDj7noqDaPbhfl54NswhO4Ackhyphenhyphent4z14Ht87MoJ5Urpp-9U-0EKpEWmyV3Mz_yA5BP46Kex00xC3EBkcSMWg83p9D_C3yDBKmVjuzBF1K7_9ExWshzUD9ql3D8XpvCnvmdrbU/s400/RotationAxisReactor+Menu.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="115" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiXNtg3ycFDj7noqDaPbhfl54NswhO4Ackhyphenhyphent4z14Ht87MoJ5Urpp-9U-0EKpEWmyV3Mz_yA5BP46Kex00xC3EBkcSMWg83p9D_C3yDBKmVjuzBF1K7_9ExWshzUD9ql3D8XpvCnvmdrbU/s400/RotationAxisReactor+Menu.png" width="400" /></a></div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhKsyDIuxfUfaEI54HONIqmGcESmbtW29rWLbrsuwFgWuJdq9pCFmCQwm4Oqtq71FwNlwEq4sboVxdAvJs3lEtQJ9tK5oPydN4ggLfXHGCzHUKNOgA1BV06sVmuoXTpUAzy4a1iGn7ZLIs/s200/RotationAxisReactor+Block.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhKsyDIuxfUfaEI54HONIqmGcESmbtW29rWLbrsuwFgWuJdq9pCFmCQwm4Oqtq71FwNlwEq4sboVxdAvJs3lEtQJ9tK5oPydN4ggLfXHGCzHUKNOgA1BV06sVmuoXTpUAzy4a1iGn7ZLIs/s200/RotationAxisReactor+Block.png" /></a></div>
<div>
<br /></div>
<div>
RotationAxisReactor는 X, Y, Z축 중 하나에 대한 회전을 각도로 제어할 수 있습니다.</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiqycfSrvNrD9um36dWsnFqVs62s0Ker7REFw4nXWgw_fJ-3tWkpC7isryQOF3sZ4RP61TIsCTVQmG2LX2NjHsqaFnjzqjcXVfGOdF7dMlgdwVykoKxxcvh8Z8QjU7mzn8mC1vKhxOLuSY/s320/RotationAxisReactor+Inspector.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiqycfSrvNrD9um36dWsnFqVs62s0Ker7REFw4nXWgw_fJ-3tWkpC7isryQOF3sZ4RP61TIsCTVQmG2LX2NjHsqaFnjzqjcXVfGOdF7dMlgdwVykoKxxcvh8Z8QjU7mzn8mC1vKhxOLuSY/s320/RotationAxisReactor+Inspector.png" /></a></div>
<div>
</div>
<br />
<ul>
<li>upAxis: 회전 중심축</li>
<li>forwardAxis: 회전 방향축</li>
<li>invert: 제어각에 대해 반대 회전 여부</li>
<li>use Gizmo: Gizmo 사용 여부</li>
</ul>
<div>
로봇의 한 관절을 RotationAxisReactor를 이용해서 맞춘다면 3D 물체가 회전할 때 서보 모터도 같이 움직이게 됩니다.</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://www.pronobis.pro/teaching/el2310/project1/3dof-robot.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://www.pronobis.pro/teaching/el2310/project1/3dof-robot.jpg" height="183" width="200" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">로봇 구조를 3차원 회전으로 해석한 예</td></tr>
</tbody></table>
<div>
<br /></div>
<div>
RotationAxisReactor와 GenericServo 연결은 다음과 같습니다.</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhlx9r2WAMLTuZk-KcDn9fKD_tFNkjbD3ztn_zHgqzQ2Ffyrf2M3rc2J3dKCLfyfNdvV545XKQulLCLXEIoldXnDE0axVFb2D0vx1jQOKKa_s3r8EfriTHFEWENx7xDXQ3NL8LjgyKhJMY/s1600/RotationAxisReactor+Wiring.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="155" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhlx9r2WAMLTuZk-KcDn9fKD_tFNkjbD3ztn_zHgqzQ2Ffyrf2M3rc2J3dKCLfyfNdvV545XKQulLCLXEIoldXnDE0axVFb2D0vx1jQOKKa_s3r8EfriTHFEWENx7xDXQ3NL8LjgyKhJMY/s320/RotationAxisReactor+Wiring.png" width="320" /></a></div>
<div>
<br /></div>
<div>
GenericServo를 이용해서 서보 모터를 제어하는 모습을 동영상으로 보시기 바랍니다.</div>
<div class="separator" style="clear: both; text-align: center;">
<iframe width="320" height="266" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/Z5FcbeZU4XQ/0.jpg" src="https://www.youtube.com/embed/Z5FcbeZU4XQ?feature=player_embedded" frameborder="0" allowfullscreen></iframe></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
서보 모터를 이용해서 로봇을 제어하는 모습도 보여드리겠습니다. (로봇 제어 방법에 대해서는 향후, 자세히 다루겠습니다.)</div>
<div class="separator" style="clear: both; text-align: center;">
<iframe width="320" height="266" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/il4Bey4rJg4/0.jpg" src="https://www.youtube.com/embed/il4Bey4rJg4?feature=player_embedded" frameborder="0" allowfullscreen></iframe></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
Anonymoushttp://www.blogger.com/profile/10315630713623521810noreply@blogger.com4tag:blogger.com,1999:blog-2144160700871786133.post-74703666558754893152016-09-05T13:22:00.002+09:002016-09-05T13:22:48.828+09:00GenericServoGenericServo는 서보(Servo) 모터를 제어하기 위한 ArdunityController입니다.<br />
서보 모터란, 명령한 목표에 근접하기 위해 스스로 제어하는 모터를 의미합니다. 이로 인해서 서보 모터는 스스로 제어하기 위한 방법으로 피드백 제어(Feedback Control)라 불리는 방식을 사용하는데, PID 제어가 대표적인 피드백 제어 방식입니다.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://upload.wikimedia.org/wikipedia/commons/thumb/2/24/Feedback_loop_with_descriptions.svg/400px-Feedback_loop_with_descriptions.svg.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="100" src="https://upload.wikimedia.org/wikipedia/commons/thumb/2/24/Feedback_loop_with_descriptions.svg/400px-Feedback_loop_with_descriptions.svg.png" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">피드백 제어 개념도</td></tr>
</tbody></table>
<br />
일반적으로 서보 모터라 하면 각도(Angle)로 제어할 수 있는 모터를 의미합니다. 각도 제어 모터가 활용되는 대표적 분야는 로봇 분야입니다.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://preview.turbosquid.com/Preview/2014/08/03__15_41_30/RobotArm2_000.jpg9061a613-b2f6-4514-a9f8-c54c2ff9a443Original.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://preview.turbosquid.com/Preview/2014/08/03__15_41_30/RobotArm2_000.jpg9061a613-b2f6-4514-a9f8-c54c2ff9a443Original.jpg" height="200" width="200" /></a></div>
<br />
서보 모터 대중화에 가장 크게 공헌한 것은 RC 서보 모터입니다. RC 자동차의 조향 장치로 많이 사용되며 값이 싸고 제어 방법이 간단하다는 것이 특징입니다.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://www.conrad.com/medias/global/ce/2000_2999/2000/2060/2064/206461_BB_00_FB.EPS_1000.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://www.conrad.com/medias/global/ce/2000_2999/2000/2060/2064/206461_BB_00_FB.EPS_1000.jpg" height="200" width="200" /></a></div>
<br />
GenericServo는 바로 RC 서보 모터를 제어할 수 있는 기능을 제공합니다.<br />
RC 서보 모터는 PWM 신호로 각도가 제어됩니다.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://i.stack.imgur.com/s4cVE.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://i.stack.imgur.com/s4cVE.png" height="143" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">RC 서보 모터 제어를 위한 PWM 규격</td></tr>
</tbody></table>
<br />
아두이노에서는 RC 서보를 쉽게 사용할 수 있도록 Servo 라이브러리가 존재합니다. GenericServo는 아두이노의 Servo 라이브러리로 RC 서보 모터를 제어합니다.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj4KtMEDMOYMY_A1Brx-J293dcnJPtasBkVyjzDjuNTGw6KzogsWhDEUVI1V-K0FEjOgPwG3bhMaNElmAZZUKtsBOT0i6Mhc_4CiySr2n1gmiUnqq17BpRLl1alMt-HnYPhB5yVzTQb7h8/s1600/GenericServo+Menu.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="73" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj4KtMEDMOYMY_A1Brx-J293dcnJPtasBkVyjzDjuNTGw6KzogsWhDEUVI1V-K0FEjOgPwG3bhMaNElmAZZUKtsBOT0i6Mhc_4CiySr2n1gmiUnqq17BpRLl1alMt-HnYPhB5yVzTQb7h8/s400/GenericServo+Menu.png" width="400" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgk48nUIZoF2_a9PhuSdeF7rWoQ6htX0XBSLvj3BV3JEWTfIBbYmULLvmYM07-ByuvcR06j6SplHLrAU4h8wI4pU7aBczSkp771X8bUIuyYFN7TOEUFaa9wRmx0OI2qfeEaF4yCRq8nuKU/s1600/GenericServo+Block.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="200" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgk48nUIZoF2_a9PhuSdeF7rWoQ6htX0XBSLvj3BV3JEWTfIBbYmULLvmYM07-ByuvcR06j6SplHLrAU4h8wI4pU7aBczSkp771X8bUIuyYFN7TOEUFaa9wRmx0OI2qfeEaF4yCRq8nuKU/s200/GenericServo+Block.png" width="155" /></a></div>
<br />
GenericServo를 사용하기 위해서는 다음과 같은 설정을 해야 합니다.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhbZAUxSplAiJIrYY-k2o71N7enM0RKyuJBlNcNtgLPU8Jml3TeXkyVnLUWEfmEaw7oC4Y8UqShgF02wU-Y4jJqUH8D7KLn-DJheMRm9CDz8c0ZFaNRfpxHJissNKR4k5OqPkpNq5CZhc0/s1600/GenericServo+Inspector.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="197" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhbZAUxSplAiJIrYY-k2o71N7enM0RKyuJBlNcNtgLPU8Jml3TeXkyVnLUWEfmEaw7oC4Y8UqShgF02wU-Y4jJqUH8D7KLn-DJheMRm9CDz8c0ZFaNRfpxHJissNKR4k5OqPkpNq5CZhc0/s320/GenericServo+Inspector.png" width="320" /></a></div>
<br />
<ul>
<li>id: ArdunityApp이 ArdunityController를 구분하기 위한 식별자</li>
<li>pin: 서보 모터 제어를 위한 PWM 핀</li>
<li>Calibrated Angle: Center Angle을 맞추기 위한 보상 각도</li>
<li>Min Angle: 회전 최소 각도</li>
<li>Max Angle: 회전 최대 각도</li>
<li>Angle: 서보 모터의 제어 각도</li>
</ul>
<div>
<b>캘리브레이션(Calibration)</b></div>
<div>
캘리브레이션이란, 오차(Error)를 보상하기 위한 과정을 말합니다. 서보 모터에서 캘리브레이션이란 각도에 대한 오차 보상을 의미합니다.</div>
<div>
RC 서보 모터는 가격이 싼 만큼 실제 각도와 제어 각도의 편차가 존재합니다. (정밀도가 높은 서보 모터는 이 작업을 할 필요가 없습니다.)</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://stubby.digitalcave.ca/stubby/img/tibia_calibration_correct.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://stubby.digitalcave.ca/stubby/img/tibia_calibration_correct.jpg" height="240" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">서보 모터의 실제 각도를 측정하면 차이가 생긴다.</td></tr>
</tbody></table>
<div>
이 오차 각도를 맞춰야 할 필요가 있는 경우 Calibrated Angle을 설정함으로써 맞출 수 있습니다.</div>
<div>
<br /></div>
<div>
<b>제한 각(Angle Limitation)</b></div>
<div>
서보 모터는 0 ~ 180도 제어 범위를 갖습니다. 실제로 서보 모터를 이용해서 구조물을 만들게 되면 이 제어 범위를 다 사용할 경우 구조물이나 모터에 손상이 가는 문제가 발생할 수 있습니다.</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://robosavvy.com/store/images/DAGU_6DoF_RobotArm50cm.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://robosavvy.com/store/images/DAGU_6DoF_RobotArm50cm.jpg" height="240" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">서보 모터로 로봇을 만들 경우 각도 제한이 필요합니다.</td></tr>
</tbody></table>
<div>
<br /></div>
<div>
Min Angle과 Max Angle은 제어 각의 한계 치를 정함으로써 이런 문제가 사전에 발생하지 않도록 만들 수 있습니다.</div>
<div>
<br /></div>
<div>
<b>제어 각도과 실제 각도</b></div>
<div>
GenericServo의 Angle 값을 변경하면 실제 서보 모터의 각도가 변경됩니다. Angle의 값의 범위는 -90 ~ 90이며 0이 가운데(Center) 각도를 의미합니다.</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjXg0ZhYpRTt3HhqsdZHoIrRxbDcqbue8-EdfNvTnmnILoeqcQHZQA-m5sqyEcYEPk42rZ6dRW7C0hzOt5hpFYjSFUY74IUxLDMdrT9Mf7DLFdCpeW5rRFAjLCobj6FV0sJRzSk93npGZM/s1600/GenericServo+Angle.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="92" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjXg0ZhYpRTt3HhqsdZHoIrRxbDcqbue8-EdfNvTnmnILoeqcQHZQA-m5sqyEcYEPk42rZ6dRW7C0hzOt5hpFYjSFUY74IUxLDMdrT9Mf7DLFdCpeW5rRFAjLCobj6FV0sJRzSk93npGZM/s200/GenericServo+Angle.png" width="200" /></a></div>
<div>
<br /></div>
<div>
GenericServo를 사용하기 위해서는 Wire Editor에서 다음과 같이 연결하면 되고, 이것을 아두이노 스케치로 생성하여 업로드하면 모든 제어 준비가 끝납니다.</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFWPpJIgFxDbDTBSUAkw4QjTHrduLCxvBKe7VjVLIejunleOhHzWqenMBLRnXwFEYtEYNlDpPsQEn7PbwYOtX4yYCEjM4NL3SbrXqUXeOw2nHXReLMXhCtjuIPqWKRdIqxgRaHkN8jur8/s1600/GenericServo+Wiring.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="146" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFWPpJIgFxDbDTBSUAkw4QjTHrduLCxvBKe7VjVLIejunleOhHzWqenMBLRnXwFEYtEYNlDpPsQEn7PbwYOtX4yYCEjM4NL3SbrXqUXeOw2nHXReLMXhCtjuIPqWKRdIqxgRaHkN8jur8/s400/GenericServo+Wiring.png" width="400" /></a></div>
<div>
<br /></div>
<div>
이제 남은 것은 유니티에서 GenericServo를 제어하는 것입니다.</div>
<div>
C# Script로 GenericServo의 Angle을 변경할 수 있으며 예제 코드는 다음과 같습니다.</div>
<div>
(본 예제는 보드 연결 시 서보 모터 각도를 -90도에서 90도까지 왕복합니다.)</div>
<pre><code class="language-csharp">
using UnityEngine;
using System.Collections;
using Ardunity;
public class MyComponent : MonoBehaviour
{
public GenericServo servo;
private bool _toggle = true;
private float _angle;
void Start ()
{
_angle = servo.angle;
}
void Update ()
{
if(servo.connected)
{
if(_toggle == true)
{
_angle += 0.01f;
if(_angle >= 90f)
{
_angle = 90f;
_toggle = false;
}
}
else
{
_angle -= 0.01f;
if(_angle <= -90f)
{
_value = -90f;
_toggle = true;
}
}
servo.angle = _angle;
}
}
}
</code>
</pre>
Anonymoushttp://www.blogger.com/profile/10315630713623521810noreply@blogger.com1tag:blogger.com,1999:blog-2144160700871786133.post-83691262565189761792016-09-02T20:44:00.001+09:002016-09-18T14:14:22.467+09:00ArdunityController 만들기ArdunityController는 아두이노에 연결된 회로를 유니티에서 제어할 수 있는 기능입니다. 아두니티에는 많이 사용할만한 ArdunityController가 포함되어있습니다.<br />
현재 포함되어있는 대표적 ArdunityController는 다음과 같습니다.<br />
<ul>
<li>DigitalOutput: 아두이노 보드 Pin의 디지털 출력 제어</li>
<li>DigitalInput: 아두이노 보드 Pin의 디지털 입력 확인</li>
<li>AnalogOutput: 아두이노 보드 Pin의 PWM 출력 제어</li>
<li>AnalogInput: 아두이노 보드 Pin의 ADC 입력 확인</li>
<li>GenericServo: 아두이노 Servo 라이브러리를 이용한 서보 모터 제어</li>
<li>GenericTone: 아두이노 Tone라이브러리를 이용한 Buzzer 제어</li>
<li>GenericMotor: H-bridge 회로기반 DC 모터 제어 (Deluxe 버전)</li>
<li>MPUSeries: MPU-XXXX기반 AHRS 센서 입력 확인 (Deluxe 버전)</li>
</ul>
<div>
위 기능만으로도 많은 것을 할 수 있지만, 프로젝트를 진행하다보면 필요한 기능이 생기게 됩니다. 이런 경우 필요한 기능이 아두니티가 업데이트되면서 추가된다면 가장 좋겠지만, 그렇지 않다면 매우 난감할 것입니다. 본 포스트는 직접 ArdunityController를 제작하는 방법에 대해 소개하여 필요한 기능을 직접 개발하는데 도움이 되고자 합니다.</div>
<div>
우선, 본 포스트의 내용을 이해하기 위해 필요한 배경지식은 다음과 같습니다.</div>
<div>
<ul>
<li>C++에 대한 이해</li>
<li>유니티 C# Script에 대한 이해</li>
</ul>
<div>
위 개념에 대해 여기서는 다루지 않으니 다른 방법을 통해 기초를 익히기를 권장합니다.</div>
</div>
<div>
<br /></div>
<div>
아두니티는 아두이노와 유니티를 연결해주는 소프트웨어입니다.</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://sites.google.com/site/ardunitydoc/_/rsrc/1460688555884/home/WhatARDUnity.png?height=120&width=400" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="96" src="https://sites.google.com/site/ardunitydoc/_/rsrc/1460688555884/home/WhatARDUnity.png?height=120&width=400" width="320" /></a></div>
<div>
<br /></div>
<div>
이 말은 아두니티 안에는 아두이노용 소프트웨어와 유니티용 소프트웨어가 포함되어있다는 뜻입니다.</div>
<div>
따라서, ArdunityController를 만들기 위해서는 아두이노용 ArdunityController와 유니티용 ArdunityController를 만들어야 합니다.</div>
<div>
<br />
<br /></div>
<div>
<b>아두이노용 ArdunityController 만들기</b></div>
<div>
아두이노는 소프트웨어 개발 시 C/C++를 사용하므로 ArdunityController도 마찬가지로 C/C++로 개발해야 합니다.</div>
<div>
ArdunityController는 다음과 같이 C++ Class 형태를 가집니다.</div>
<pre><code class="language-cpp">
class MyController
{
public:
MyController();
protected:
private:
};
</code>
</pre>
<div>
이 Class는 별도의 파일로 존재해야 하므로 컴파일 시 중복 Include 에러가 나지 않도록 전처리문(Preprocessor)을 추가해야 합니다.</div>
<pre><code class="language-cpp">
#ifndef MyController_h
#define MyController_h
class MyController
{
public:
MyController();
protected:
private:
};
#endif
</code>
</pre>
<div>
그 다음으로 할 일은 이미 기본 기능이 만들어져있는 ArdunityController Class를 상속(Inheritance)받는 것입니다.</div>
<pre><code class="language-cpp">
#ifndef MyController_h
#define MyController_h
#include "ArdunityController.h"
class MyController : public ArdunityController
{
public:
MyController(int id);
protected:
void OnSetup();
void OnStart();
void OnStop();
void OnProcess();
void OnUpdate();
void OnExecute();
void OnFlush();
private:
};
#endif
</code>
</pre>
<div>
ArdunityController Class를 상속받을 때 해야 할 일은 다음과 같습니다.<br />
<ul>
<li>Controller ID 초기화</li>
<li>가상 함수(Virtual Function)의 구현</li>
</ul>
<div>
ArdunityController Class의 가상 함수는 다음과 같은 역할을 합니다.</div>
<div>
<ul>
<li>OnSetup: 아두이노 setup 실행 시 호출</li>
<li>OnStart: 유니티와 연결되었을 때 호출</li>
<li>OnStop: 유니티와 연결이 끊어졌을 때 호출</li>
<li>OnProcess: 아두이노 loop 실행 시 호출</li>
<li>OnUpdate: 유니티로부터 데이터를 받았을 때 호출</li>
<li>OnExecute: 유니티로부터 받은 데이터를 제어에 사용할 때 호출</li>
<li>OnFlush: 유니티에 데이터를 전송할 때 호출</li>
</ul>
<div>
<br /></div>
</div>
<div>
Controller ID를 초기화하는 좋은 방법은 Class 생성시 인자(Argument)로 받는 것입니다.</div>
<div>
여기서 꼭 결정해야 할 것은 유니티로 데이터를 보낼 것인지 여부이며, canFlush 변수로 설정할 수 있습니다.<br />
<ul>
<li>유니티로 데이터를 보낼 경우 canFlush는 TRUE입니다.</li>
<li>유니티로 데이터를 보내지 않는 경우 canFlush는 FALSE입니다.</li>
</ul>
</div>
<pre><code class="language-cpp">
MyController::MyController(int id) : ArdunityController(id)
{
canFlush = true; // If send data to Unity, must set true.
canFlush = false; // If do not send data to Unity, must set false.
}
</code>
</pre>
<div>
이제 할 일은 유니티와 공유할 데이터 타입을 결정하는 것입니다. 아두니티는 다음과 같은 데이터 타입을 지원합니다.<br />
<ul>
<li>UINT8: 8bit 부호없는 정수 (0 ~ 255)</li>
<li>INT8: 8bit 부호있는 정수 (-128 ~ 127)</li>
<li>UINT16: 16bit 부호없는 정수 (0 ~ 65,535)</li>
<li>INT16: 16bit 부호있는 정수 (-32,768 ~ 32,767)</li>
<li>UINT32: 32bit 부호없는 정수 (0 ~ 4,294,967,295<span style="color: #2a2a2a; font-family: "segoe ui" , "lucida grande" , "verdana" , "arial" , "helvetica" , sans-serif;"><span style="font-size: 13px; line-height: 18px;">)</span></span></li>
<li>INT32: 32bit 부호있는 정수 (–2,147,483,648 ~ 2,147,483,647)</li>
<li>FLOAT32: 32bit 부동 소수</li>
<li>STRING: 문자열 (최대 길이 255)</li>
</ul>
<div>
이것은 ArdunityController에 다음과 같이 정의될 수 있습니다. 주의할 점은 STRING 타입을 사용할 때 실제 문자열을 저장할 버퍼(Buffer)는 별도로 선언해야 한다는 것입니다.</div>
</div>
<pre><code class="language-cpp">
#ifndef MyController_h
#define MyController_h
#include "ArdunityController.h"
class MyController : public ArdunityController
{
public:
MyController(int id);
protected:
void OnSetup();
void OnStart();
void OnStop();
void OnProcess();
void OnUpdate();
void OnExecute();
void OnFlush();
private:
UINT8 uint8_data;
INT8 int8_data;
UINT16 uint16_data;
INT16 int16_data;
UINT32 uint32_data;
INT32 int32_data;
FLOAT32 float32_data;
STRING string_data;
char stringBuffer[50];
};
#endif
</code>
</pre>
<div>
STRING 타입 변수와 버퍼를 연결하는 것은 Class 생성자에서 다음과 같이 할 수 있습니다.</div>
<pre><code class="language-cpp">
MyController::MyController(int id) : ArdunityController(id)
{
string_data = stringBuffer;
canFlush = true; // If send data to Unity, must set true.
canFlush = false; // If do not send data to Unity, must set false.
}
</code>
</pre>
<div>
유니티로부터 데이터를 받은 것이 있다면, OnUpdate 함수가 실행됩니다. 그러므로 이때 여러분은 버퍼(Buffer)로부터 데이터를 꺼내서 변수에 옮기면 됩니다.<br />
이 버퍼(Buffer)를 갖고 있는 것이 바로 ArdunityApp Class이며 pop함수를 이용해서 꺼낼 수 있습니다.<br />
ArdunityApp Class를 사용하기 위해 Ardunity.h 헤더 파일을 포함시켜야 합니다.</div>
<pre><code class="language-cpp">
#include "Ardunity.h"
void MyController::OnUpdate()
{
ArdunityApp.pop(&uint8_data);
ArdunityApp.pop(&int8_data);
ArdunityApp.pop(&uint16_data);
ArdunityApp.pop(&int16_data);
ArdunityApp.pop(&uint32_data);
ArdunityApp.pop(&int32_data);
ArdunityApp.pop(&float32_data);
ArdunityApp.pop(string_data, 50);
updated = true; // It must be set true to run OnExecute
}
</code>
</pre>
<div>
STRING타입 변수에 데이터를 옮길때는 미리 선언한 버퍼의 크기를 알려줘야 합니다.<br />
OnUpdate에서 데이터 처리 시 주의 할 점은 꺼내는(Pop) 순서입니다. 이 순서는 유니티용 ArdunityController의 집어넣는(Push) 순서와 동일해야 합니다.<br />
<i><span style="color: red;">만약, 유니티에서 data1, data2, data3의 순서로 집어넣었다면, 아두이노에서 data1, data2, data3의 순서로 꺼내야 합니다.</span></i></div>
</div>
<div>
데이터 수신이 완료되었다면 OnExecute를 실행하여 할 일을 하는 것입니다. OnExecute는 updated 변수가 true가 되어야 실행되므로 필요한 경우 updated 변수를 true로 설정해야 합니다. updated 변수는 OnExecute가 실행 된 후, 자동으로 false로 바뀝니다.</div>
<div>
<br /></div>
<div>
OnProcess 함수는 아두이노 보드 실행 중에 할 일을 수행하게 됩니다. 이 함수에서 할 일은 다음과 같이 생각할 수 있습니다.</div>
<div>
<ul>
<li>유니티에 보낼 데이터를 수집한다.</li>
<li>주기적으로 해야 할 일을 처리한다.</li>
</ul>
<div>
OnProcess 함수는 유니티와 연결됨과 상관 없이 항상 실행되기 때문에 현재, 유니티와 연결 중인지 확인할 필요가 있습니다. started 변수는 이것을 확인할 수 있는 기능을 제공합니다.<br />
유니티에 보낼 데이터 수집이 완료되었다면, dirty변수를 true로 만들어 OnFlush 함수가 실행되게 할 수 있습니다.</div>
</div>
<pre><code class="language-cpp">
void MyController::OnProcess()
{
if(started)
{
// When connected to Unity
dirty = true; // It must be set true to run OnFlush
}
else
{
// When disconnected to Unity
}
}
</code>
</pre>
<div>
이제 남은 것은 수집된 데이터를 유니티에 보내는 것입니다. 이것을 수행하기 위해 OnFlush 함수를 완성해야 합니다. 유니티에 데이터를 보내기 위해서는 ArdunityApp의 버퍼(Buffer)에 데이터를 집어넣는 것이며 ArdunityApp Class의 push 함수를 이용합니다.<br />
OnUpdate 때와 마찬가지로 데이터를 집어넣는(Push) 순서가 중요합니다. 이 순서는 유니티용 ArdunityController에서 꺼내는(Pop) 순서와 동일해야 합니다.<br />
<i><span style="color: red;">만약, 아두이노에서 data1, data2, data3의 순서로 집어넣었다면, 유니티에서 data1, data2, data3의 순서로 꺼내야 합니다.</span></i><br />
Pop때와는 달리 Push 실행 시 STRING 타입의 경우 버퍼의 크기를 알려줄 필요가 없는데, 그 이유는 문자열의 끝을 자동으로 인식해서 데이터 길이를 알아내기 때문입니다.</div>
<pre><code class="language-cpp">
void MyController::OnFlush()
{
ArdunityApp.push(uint8_data);
ArdunityApp.push(int8_data);
ArdunityApp.push(uint16_data);
ArdunityApp.push(int16_data);
ArdunityApp.push(uint32_data);
ArdunityApp.push(int32_data);
ArdunityApp.push(float32_data);
ArdunityApp.push(string_data);
}
</code>
</pre>
<div>
여기까지 했다면 아두이노용 ArdunityController 구현은 모두 완료한 것입니다. 마지막으로 해야 할 일은 만든 ArdunityController의 헤더 파일(*.h)과 소스 파일(*.cpp)을 유니티 에셋 폴더에 넣어두는 것입니다.<br />
유니티 에셋 폴더에 넣는 이유는 유니티에 있는 ArdunityApp 컴포넌트가 아두이노 스케치를 자동 생성할 때 작성한 헤더 파일과 소스 파일을 아두이노 스케치 폴더에 복사하기 때문입니다. 아무데나 위치시키면 안되고 반드시 "Arduino" 이름의 폴더에 넣어두어야 합니다. 여러분이 만든 폴더도 상관없는데, 폴더의 이름만 "Arduino"로 만들면 됩니다.<br />
<br />
<br />
<b>유니티용 ArdunityController 만들기</b><br />
유니티에서 C# Script를 생성하면 다음과 같은 모습을 가집니다.</div>
<pre><code class="language-csharp">
using UnityEngine;
using System.Collections;
public class MyController : MonoBehaviour
{
void Start()
{
}
void Update()
{
}
}
</code>
</pre>
<div>
다음으로 할 일은 기본 기능이 만들어져있는 ArdunityController를 상속(Inheritance)받는 것입니다.<br />
ArdunityController는 namespace Ardunity에 있으므로 추가시켜야 합니다.</div>
<pre><code class="language-csharp">
using UnityEngine;
using System.Collections;
using Ardunity;
public class MyController : ArdunityController
{
protected override void Awake()
{
}
void Start()
{
}
void Update()
{
}
protected override void OnPush()
{
}
protected override void OnPop()
{
}
protected override void OnExecuted()
{
}
protected override void OnConnected()
{
}
protected override void OnDisconnected()
{
}
protected override void OnReset()
{
}
public override string[] GetAdditionalFiles()
{
return null;
}
public override string[] GetCodeIncludes()
{
return null;
}
public override string[] GetCodeDefines()
{
return null;
}
public override string GetCodeDeclaration()
{
return "";
}
public override string GetCodeVariable()
{
return "";
}
}
</code>
</pre>
<div>
유니티용 ArdunityController를 만들기 위해서는 다음의 함수를 완성해야 합니다.<br />
<ul>
<li>Awake: MonoBehaviour의 Awake함수</li>
<li>OnPush: 아두이노에 데이터를 보낼 때 실행</li>
<li>OnPop: 아두이노로부터 데이터를 받았을 때 실행</li>
<li>OnExecuted: 아두이노로부터 데이터를 제어에 사용할 때 실행</li>
<li>OnConnected: 아두이노와 연결되었을 때 실행</li>
<li>OnDisconnected: 아두이노와 연결이 끊어졌을 때 실행</li>
<li>OnReset: 아두이노 보드가 연결 중 리셋되었을 때 실행</li>
<li>GetAdditionalFiles: 아두이노 스케치 생성 시 실행</li>
<li>GetCodeIncludes: 아두이노 스케치 생성 시 실행</li>
<li>GetCodeDefines: 아두이노 스케치 생성 시 실행</li>
<li>GetCodeDeclaration: 아두이노 스케치 생성 시 실행</li>
<li>GetCodeVariable: 아두이노 스케치 생성 시 실행</li>
</ul>
<div>
유니티 C# Script의 기본인 MonoBehaviour은 최초 시작 시 실행되는 Awake 함수를 갖고 있습니다. ArdunityController는 이미 Awake함수를 사용하고 있기때문에 반드시 override해야 하며 ArdunityController의 Awake 함수를 실행해야 합니다.<br />
여기서 꼭 결정해야 할 것은 아두이노로부터 데이터를 받을 것인지 여부이며, enableUpdate로 설정할 수 있습니다.<br />
<ul>
<li>아두이노로부터 데이터를 받을 경우 enableUpdate는 TRUE입니다.</li>
<li>아두이노로부터 데이터를 받지 않는 경우 enableUpdate는 FALSE입니다.</li>
</ul>
</div>
</div>
<pre><code class="language-csharp">
protected override void Awake()
{
base.Awake();
enableUpdate = true; // If receive data from Arduino, must set true.
enableUpdate = false; // If do not receive data from Arduino, must set false.
}
</code>
</pre>
<div>
이제 할 일은 아두이노와 공유할 데이터 타입을 정하는 것입니다. 사용 가능한 데이터 타입은 아두이노용 ArdunityController와 동일합니다. 다만, C#에서는 using을 이용해서 사용할 데이터 타입을 정의해줘야 합니다. 이것은 ARDUnity/Scripts/Internal 폴더 안에 ControllerDataType.cs에 있으니 복사해서 사용하면 됩니다.<br />
<ul>
</ul>
</div>
<pre><code class="language-csharp">
using INT8 = System.SByte;
using UINT8 = System.Byte;
using INT16 = System.Int16;
using UINT16 = System.UInt16;
using INT32 = System.Int32;
using UINT32 = System.UInt32;
using FLOAT32 = System.Single;
using STRING = System.String;
public class MyController : ArdunityController
{
private UINT8 uint8_data;
private INT8 int8_data;
private UINT16 uint16_data;
private INT16 int16_data;
private UINT32 uint32_data;
private INT32 int32_data;
private FLOAT32 float32_data;
private STRING string_data = "";
</code>
</pre>
<div>
아두이노로부터 데이터를 받은 것이 있다면, OnPop 함수가 실행됩니다. 그러므로 이때 여러분은 버퍼(Buffer)로부터 데이터를 꺼내서 변수로 옮기면 됩니다. Pop 함수를 이용하면 이 작업을 수행할 수 있습니다.<br />
<div>
데이터 처리 시 주의 할 점은 꺼내는(Pop) 순서입니다. 이 순서는 아두이노용 ArdunityController의 집어넣는(Push) 순서와 동일해야 합니다.<br />
<i><span style="color: red;">만약, 아두이노에서 data1, data2, data3의 순서로 집어넣었다면, 유니티에서 data1, data2, data3의 순서로 꺼내야 합니다.</span></i></div>
<div>
데이터 수신이 완료되었다면 OnExecuted 함수가 실행되어 아두이노로부터 받은 데이터를 처리할 수 있습니다. OnExecuted 함수를 실행시키려면 updated 변수의 값을 true로 설정합니다.</div>
<pre><code class="language-csharp">
protected override void OnPop()
{
Pop(ref uint8_data);
Pop(ref int8_data);
Pop(ref uint16_data);
Pop(ref int16_data);
Pop(ref uint32_data);
Pop(ref int32_data);
Pop(ref float32_data);
Pop(ref string_data);
updated = true;
}
</code>
</pre>
<div>
아두이노에 데이터를 보내려면 먼저 필요한 데이터를 수집해야 합니다. 유니티에서 데이터를 수집하는 가장 일반적인 방법은 Update 함수에서 처리하는 것입니다.<br />
Update 함수는 아두이노 연결 유무와 상관 없이 항상 실행되므로 아두이노 연결 유무를 알 필요가 있습니다. connected 변수 값을 확인하면 아두이노 연결 유무를 알 수 있습니다.<br />
유니티가 아두이노에 데이터를 보내려면 OnPush 함수가 실행되어야 합니다. OnPush 함수를 실행시키려면 SetDirty 함수를 호출하면 됩니다.</div>
<pre><code class="language-csharp">
void Update()
{
if(connected)
{
SetDirty();
}
else
{
}
}
</code>
</pre>
<div>
OnPush 함수에서는 아두이노로 데이터를 보내면 됩니다. Push 함수를 이용해서 처리할 수 있으며 아두이노에서와 마찬가지로 순서가 중요합니다.<br />
<i><span style="color: red;">만약, 유니티에서 data1, data2, data3의 순서로 집어넣었다면, 아두이노에서 data1, data2, data3의 순서로 꺼내야 합니다.</span></i></div>
<pre><code class="language-csharp">
protected override void OnPush()
{
Push(uint8_data);
Push(int8_data);
Push(uint16_data);
Push(int16_data);
Push(uint32_data);
Push(int32_data);
Push(float32_data);
Push(string_data);
}
</code>
</pre>
<div>
이제 남은 것은 아두이노 스케치 생성입니다. 유니티용 ArdunityController는 아두이노용 ArdunityController를 사용할 수 있도록 아두이노 스케치를 작성해야 합니다. 유니티의 ArdunityApp은 Export Sketch 기능 실행 시 아두이노 스케치를 작성하면서 여러분이 만든 ArdunityController 차례가 올때마다 알려줍니다.<br />
GetCodeDeclaration 함수는 아두이노용 ArdunityController Class를 선언시켜 줍니다. GetCodeVariable함수는 Class 선언 시 사용되는 인스턴스(Instance) 이름을 만들어 주기에 같이 사용하면 좋습니다.</div>
<pre><code class="language-csharp">
public override string GetCodeDeclaration()
{
return string.Format("{0} {1}({2:d});", this.GetType().Name, GetCodeVariable(), id);
}
public override string GetCodeVariable()
{
return string.Format("myController{0:d}", id);
}
/* 위와 같이 구현한 경우 아두이노 스케치에는 다음과 같이 생성된다. */
/* Class: MyController, Controller ID: 0 */
MyController myController0(0);
</code>
</pre>
<div>
아두이노 스케치에 추가 코드를 입력해야 하는 경우는 다음의 함수를 이용할 수 있습니다.<br />
<br />
<ul>
<li>GetCodeDefines: "#define" 구문을 사용해야 하는 경우</li>
<li>GetCodeIncludes: "#include" 구문을 사용해야 하는 경우</li>
</ul>
<div>
아두이노 스케치 생성 시 아두이노용 ArdunityController Class를 위한 헤더 파일과 소스 파일은 자동으로 복사됩니다. 만약, 추가 파일을 복사해야 할 경우 GetAdditionalFiles 함수를 구현하면 필요한 파일을 복사할 수 있습니다.</div>
<div>
<br /></div>
<div>
만든 유니티용 ArdunityController는 Wire Editor 메뉴를 통해서 추가할 수 없습니다.(메뉴를 만드는 방법이 있으나 여기서는 다루지 않겠습니다.)</div>
<div>
따라서, 다른 방법으로 컴포넌트를 추가해야 하는데, 다음과 같은 방법이 있습니다.</div>
<div>
<ul>
<li>Component 메뉴를 이용 (Scripts에서 찾을 수 있음)</li>
<li>Add Component 메뉴를 이용 (Scripts에서 찾을 수 있음)</li>
<li>Project Window에서 직접 Script파일을 드래그하여 GameObject에 넣음</li>
</ul>
<div>
위와 같이 추가하면 Wire Editor와 Inspector Window에 다음과 같이 나타납니다.</div>
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMxBDrwCR1bUcjs9-TelRgbthQ-ZWhj0YqSIoYxYw-zg6XnO0n-1ENQo3m83Jv8tf_80NQMnIjdyGOuwaQpN_YEGhXM5-_8YPcE5K5dB2YmvKWORvCXp8S0ymdZ5aiAJCLfV6vvcfCE68/s1600/MyController+Inspector.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="78" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMxBDrwCR1bUcjs9-TelRgbthQ-ZWhj0YqSIoYxYw-zg6XnO0n-1ENQo3m83Jv8tf_80NQMnIjdyGOuwaQpN_YEGhXM5-_8YPcE5K5dB2YmvKWORvCXp8S0ymdZ5aiAJCLfV6vvcfCE68/s400/MyController+Inspector.png" width="400" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh_BSxDGQ6IH3-5YhDI5rKlrqmt23HQsk5wvdp7Kyszqqgs4ifpFdkkz64y2cOxJHDdOYmFgn1HCJ6doWEsJjKFAqYxOaZ3qitfCuQo2R0YcpPRZMiBYt1J0sfmtSbu8WdbDgaGU2VZ2VM/s1600/MyController+Block.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="185" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh_BSxDGQ6IH3-5YhDI5rKlrqmt23HQsk5wvdp7Kyszqqgs4ifpFdkkz64y2cOxJHDdOYmFgn1HCJ6doWEsJjKFAqYxOaZ3qitfCuQo2R0YcpPRZMiBYt1J0sfmtSbu8WdbDgaGU2VZ2VM/s200/MyController+Block.png" width="200" /></a></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
</div>
</div>
Anonymoushttp://www.blogger.com/profile/10315630713623521810noreply@blogger.com5tag:blogger.com,1999:blog-2144160700871786133.post-34423965900553349712016-09-01T16:06:00.001+09:002017-05-23T11:36:21.905+09:00ARDUnity Basic과 Deluxe 차이점아두니티는 Basic과 Deluxe 에디션으로 나뉩니다.<br />
이것들은 현재 유니티 에셋 스토어에서 서비스 중입니다.<br />
<ul>
<li><a href="https://www.assetstore.unity3d.com/?asac=8ZrCHu35oh#!/content/60643" target="_blank">ARDUnity Basic</a></li>
<li><a href="https://www.assetstore.unity3d.com/?asac=8ZrCHu35oh#!/content/62912" target="_blank">ARDUnity Deluxe</a></li>
</ul>
<div>
차이점을 표로 정리하면 다음과 같습니다.</div>
<table align="center" border="1" cellpadding="5" cellspacing="1" style="text-align: center;"><tbody>
<tr><td>비교 항목</td><td>Basic</td><td>Deluxe</td></tr>
<tr><td>가격</td><td>무료</td><td>$50</td></tr>
<tr><td>Wire Editor</td><td>O</td><td>O</td></tr>
<tr><td>PlayMaker 지원</td><td>O</td><td>O</td></tr>
<tr><td>모든 시리즈 Arduino 보드 지원 (호환 보드 포함)</td><td>O</td><td>O</td></tr>
<tr><td>시리얼 통신 (Windows/Mac)</td><td>O</td><td>O</td></tr>
<tr><td>Digital I/O 제어 (Digital Input/Output)</td><td>O</td><td>O</td></tr>
<tr><td>PWM 제어 (Analog Output)</td><td>O</td><td>O</td></tr>
<tr><td>ADC 입력 처리 (Analog Input)</td><td>O</td><td>O</td></tr>
<tr><td>서보 모터 (PWM 제어 방식)</td><td>O</td><td>O</td></tr>
<tr><td>음계 제어 (Buzzer)</td><td>O</td><td>O</td></tr>
<tr><td>DC 모터 제어</td><td>X</td><td>O</td></tr>
<tr><td>블루투스 통신 (Classic)</td><td>X</td><td>O</td></tr>
<tr><td>블루투스 4.0 통신 (HM-10 지원)</td><td>X</td><td>O</td></tr>
<tr><td>TCP/IP 통신 (WiFi)</td><td>X</td><td>O</td></tr>
<tr><td>스마트 폰 기능 사용</td><td>X</td><td>O</td></tr>
<tr><td>AHRS(자세 인식) 센서 지원</td><td>X</td><td>O</td></tr>
<tr><td>기타 여러가지 아두이노 호환 제품</td><td>X</td><td>O</td></tr>
</tbody></table>
<br />
<div>
각 버전의 목표는 다음과 같습니다.<br />
<ul>
<li>Basic: 교육 및 학습용</li>
<li>Deluxe: 프로젝트 개발용</li>
</ul>
<div>
Basic은 아두니티를 교육하거나 학습할 수 있도록 기본적인 기능 위주로 포함시켜서 요구되는 배경 지식이 많지 않고 사용되는 부품도 쉽고 저렴하게 구할 수 있게 구성되었습니다.</div>
<div>
반면에 Deluxe는 보다 다양한 활용이 가능하도록 관심도가 높고 이슈가 될 만한 기능들을 포함시켜서 좋은 품질의 프로젝트가 만들어지도록 구성되었습니다.</div>
<div>
<b><br /></b></div>
<div>
<b>업데이트</b></div>
<div>
Basic 버전은 아무래도 무료이다 보니 버그와 같이 사용에 치명적인 문제를 해결하는 정도만 지원됩니다.</div>
<div>
하지만, Deluxe 버전은 지속적으로 필요한 기능을 발굴하여 추가되기에 한번 구매로 이 서비스를 평생 받을 수 있게 됩니다.</div>
<div>
필요한 기능을 요청하게 되면 상황에 따라 우선적으로 업데이트되어 서비스를 받을 수도 있습니다.</div>
<div>
<br /></div>
<div>
<b>파트너</b></div>
<div>
아두니티를 이용해서 사업 및 활동을 하시는 분은 누구든지 파트너입니다.</div>
<div>
파트너들의 활동 결과물에 대해서는 어떤 경우도 로열티를 요구하지 않습니다.</div>
<div>
아두니티 에셋을 이용해서 할 수 있는 것들은 다음과 같이 생각해볼 수 있습니다.</div>
<div>
<ul>
<li>아두니티를 이용한 교육 활동</li>
<li>아두니티를 이용한 제품 개발</li>
<li>아두니티를 이용한 저작(책, 작품 등) 활동</li>
</ul>
<div>
만약, 위와 같은 활동을 계획하고 있는 경우 저에게(ojh6t3k@gmail.com) 연락을 주시면 기술 지원을 통해 더 빠르고 쉽게 목표에 도달할 수 있습니다.</div>
</div>
<div>
<u><span style="color: red;">파트너 활동 중 주의하셔야 할 점은 아두니티를 홍보, 교육하고자 만들어진 2차 저작물들을 저와 별도 협의 없이 이용하는 경우 법적 제재를 받을 수 있다는 것입니다.</span></u></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
</div>
Anonymoushttp://www.blogger.com/profile/10315630713623521810noreply@blogger.com0tag:blogger.com,1999:blog-2144160700871786133.post-32998624866656020672016-08-29T14:19:00.000+09:002016-08-29T14:19:10.333+09:00MPU-6050/9250 다루기IMU 혹은 AHRS 센서라 불리는 자세 인식 센서는 재미있는 효과를 보여주기에 적합한 좋은 도구입니다.<br />
현재, 여러 종류의 제품이 나와있지만 그 중에서도 가장 많이 알려진 MPU-6050과 MPU-9250을 다루는 법에 대해 기술하겠습니다.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://img.dxcdn.com/productimages/sku_154602_2.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://img.dxcdn.com/productimages/sku_154602_2.jpg" height="200" width="200" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">MPU-6050 보드</td></tr>
</tbody></table>
<br />
MPU-6050은 아두이노에서 가장 많이 알려진 IMU센서입니다. 이것은 값도 저렴하고 DMP라 부르는 센서 융합 기술을 내장하고 있기에, 기존의 칼만 필터 등으로 센서 융합 알고리즘을 구현하느라 애쓰지 않아도 되는 장점을 갖고 있습니다.<br />
MPU-9250은 6050에 비해 잘 알려져있지는 않지만, 매우 유용한 센서입니다.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://des.gearbest.com/uploads/2015/201509/heditor/201509231445577254.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://des.gearbest.com/uploads/2015/201509/heditor/201509231445577254.jpg" height="130" width="200" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">MPU-9250 보드</td></tr>
</tbody></table>
<br />
MPU-6050과 9250의 가장 큰 차이는 지자기 센서 포함 유무입니다. MPU-6050은 지자기 센서를 포함하지 않기때문에 지면과 수평인 Yaw 방향에 오차가 생깁니다. 반면에, MPU-9250은 지자기 센서를 포함하고 있기때문에 Yaw 방향에 대해서도 정확한 각도를 추출합니다.<br />
Yaw 방향의 필요성에 따라 6050 혹은 9250을 선택해서 사용하면 됩니다.<br />
<br />
MPU-6050/9250을 아두이노 보드에 연결하려면 다음과 같은 회로를 구현합니다.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjOf9IhE5SGPHkxLS2c6QEL67Li0zFBYVamVcmIqLH86QCXHbcPLVAMa1eC2Zb-9e79ebesfocIX_7LzHPd8ILMyXFTryvZNEmpO4o6uoArEqbvsLYSeqpiA6IdG57RPgIOpZgbkzgcZKI/s1600/MPUSeries+Circuit.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="252" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjOf9IhE5SGPHkxLS2c6QEL67Li0zFBYVamVcmIqLH86QCXHbcPLVAMa1eC2Zb-9e79ebesfocIX_7LzHPd8ILMyXFTryvZNEmpO4o6uoArEqbvsLYSeqpiA6IdG57RPgIOpZgbkzgcZKI/s400/MPUSeries+Circuit.png" width="400" /></a></div>
<br />
이 회로를 이해하려면 I2C 통신에 대해 알아야 합니다.<br />
대부분의 아두이노 부품은 Digital In/Out 혹은 Analog In/Out을 통해 제어했습니다. 그러나, 좀 더 복잡한 제어를 하기 위해서는 서로 정보를 교환하는 통신이란 방법이 필요합니다.<br />
IC 칩과 칩 사이의 통신을 위해 만들어진 규약이 I2C(Inter Intergrated Circuit)입니다. I2C는 SCL과 SDA라는 핀을 통해 서로 연결할 수 있습니다.<br />
아두이노 보드는 Analog 입력 핀으로 사용되는 A4와 A5가 각각 SDA, SCL로 사용될 수 있기에 I2C 연결을 위해서 이 핀을 사용합니다.<br />
<br />
회로 연결을 하고 아두니티에서 Wire Editor를 작성한다면 다음과 같이 표현됩니다.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh5pWt7Vpx7G1YcE32A8TVVW3KGyIAL33854kENKjR3JEIEYvivBHF0k4EbkXQmqxDGLjdkMPaCo7FEu7WRq_4yLvNbQ_9DSnJpBEmFk0UR5CLUVwlhkAmUp_X7N6YT0lIsHeTfXz3lGe4/s1600/MPUSeries+Wiring.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="162" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh5pWt7Vpx7G1YcE32A8TVVW3KGyIAL33854kENKjR3JEIEYvivBHF0k4EbkXQmqxDGLjdkMPaCo7FEu7WRq_4yLvNbQ_9DSnJpBEmFk0UR5CLUVwlhkAmUp_X7N6YT0lIsHeTfXz3lGe4/s400/MPUSeries+Wiring.png" width="400" /></a></div>
<br />
아두이노 스케치를 만들기 전 MPUSeries의 Sketch Option을 잘 설정해야 합니다. (<a href="http://ardunityproject.blogspot.kr/2016/08/mpuseries.html" target="_blank">설정 방법 참고</a>)<br />
MPU 보드의 Orientation을 맞추는 것은 중요합니다. 왜냐하면 MPU 보드의 방향과 유니티의 방향이 일치해야 쉽게 제어할 수 있기 때문입니다.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://www.itsqv.com/QVM/images/f/f6/IMU024a.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://www.itsqv.com/QVM/images/f/f6/IMU024a.png" height="150" width="200" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">MPU보드에는 좌표계가 있습니다.</td></tr>
</tbody></table>
<br />
주의할 점은 MPU 보드에서 Z는 위 방향을 의미하지만, 유니티에서는 Y가 위 방향이란 것입니다. 그리고, 만들다보면 MPU 보드의 방향과 유니티 방향을 맞추기 어려운 경우가 생깁니다.<br />
이런 경우 MPU보드와 유니티 방향을 재 설정하는 아두이노 스케치 옵션을 통해 맞추면 됩니다.<br />
<br />
<b>MPU 보드로 GameObject 회전시키기</b><br />
MPU 보드는 Roll, Pitch, Yaw라는 3차원 공간의 각도를 알려줍니다. 이것을 GameObject Transform의 Rotation에 사용한다면 MPU 보드로 GameObject의 회전을 제어할 수 있습니다.<br />
RotationReactor는 보드로부터 수집된 회전 정보를 GameObject Transform의 Rotation에 적용하는 기능을 갖고 있습니다.<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEirTsnT5EMBtlRhBIG2ck3OakY7hgcqUo-QXlmYzI-d7UF8nOyhs1pHcPb2O4mVEWTNcaEteh5R8nNkKYDVdAJOO4QiiArXl_D2Jc9Xcvkj0aPAgIpEfooDCbm5TU0TQZ3fuTVtp5173IE/s1600/RotationReactor+Menu.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="120" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEirTsnT5EMBtlRhBIG2ck3OakY7hgcqUo-QXlmYzI-d7UF8nOyhs1pHcPb2O4mVEWTNcaEteh5R8nNkKYDVdAJOO4QiiArXl_D2Jc9Xcvkj0aPAgIpEfooDCbm5TU0TQZ3fuTVtp5173IE/s400/RotationReactor+Menu.png" width="400" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg0k3R9l0I8ycvS73V-09irrBD9RonZUjooehzvi2WVHRhg5dgWo_5_5pyj_Z16eE6eKfEdvIC-1hgC7Dq926aubZ5EC7RrAeZGv0Qg5ZUOnOJ5te1tTAM6mH4qI3N9fBCqzCf0STzDQEs/s1600/RotationReactor+Block.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="143" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg0k3R9l0I8ycvS73V-09irrBD9RonZUjooehzvi2WVHRhg5dgWo_5_5pyj_Z16eE6eKfEdvIC-1hgC7Dq926aubZ5EC7RrAeZGv0Qg5ZUOnOJ5te1tTAM6mH4qI3N9fBCqzCf0STzDQEs/s200/RotationReactor+Block.png" width="200" /></a></div>
<br />
RotationReactor를 사용하기 위해서는 다음과 같은 설정이 필요합니다.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiAHXgcOaHOp63ZtSgTBo5p7gz-D_gZOP-kB3ttewfMnqdAWhiJYPecPjgxCAg_G1mO7O2qn_NQxHfwEI7v_jMjRbWMGYzTV_R5JncuW0fcN6JMh-GqNk1RGPi1nLavu7d_1pu2Mr3DgkY/s1600/RotationReactor+Inspector.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="92" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiAHXgcOaHOp63ZtSgTBo5p7gz-D_gZOP-kB3ttewfMnqdAWhiJYPecPjgxCAg_G1mO7O2qn_NQxHfwEI7v_jMjRbWMGYzTV_R5JncuW0fcN6JMh-GqNk1RGPi1nLavu7d_1pu2Mr3DgkY/s400/RotationReactor+Inspector.png" width="400" /></a></div>
<br />
<ul>
<li>smoothFollow: GameObject 회전이 보다 부드럽게 연결됨</li>
</ul>
<div>
<br /></div>
<div>
RotationReactor와 MPUSeries를 연결하면 MPU 보드로 회전되는 GameObject를 볼 수 있습니다.</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiE0EWLPkAIHMuSRcbFDDfWqtnHYToLrBox6APd2WM0oCsb6FFhxTPFz3guSPj6FEPVgP9A0r-TXZUys7pNDtDNmv5PdijQd1NaI42Xpq_FQWlzh8NAj6wi_Uk5DsL_-eEZAEo7K7O5BpI/s1600/RotationReactor+Wiring.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="179" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiE0EWLPkAIHMuSRcbFDDfWqtnHYToLrBox6APd2WM0oCsb6FFhxTPFz3guSPj6FEPVgP9A0r-TXZUys7pNDtDNmv5PdijQd1NaI42Xpq_FQWlzh8NAj6wi_Uk5DsL_-eEZAEo7K7O5BpI/s320/RotationReactor+Wiring.png" width="320" /></a></div>
<div>
<br /></div>
<div>
동영상을 통해 작동 모습을 직접 확인하시기 바랍니다.</div>
<div class="separator" style="clear: both; text-align: center;">
<iframe width="320" height="266" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/-W05xEaWqCc/0.jpg" src="https://www.youtube.com/embed/-W05xEaWqCc?feature=player_embedded" frameborder="0" allowfullscreen></iframe></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
Anonymoushttp://www.blogger.com/profile/10315630713623521810noreply@blogger.com7