<p align="center" style="padding: 0px; line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff; text-align: center;"><span style="color: #a6cf00; font-family: &quot;3287760_9&quot;; font-size: 18pt;"></span><span style="color: #ff0000; font-family: &quot;994265_10&quot;; font-size: 14pt;"><strong>5핀 무한회전 로터리 엔코더 모듈</strong></span></p>
<p align="center" style="padding: 0px; line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff; text-align: center;"><span style="color: #ff0000; font-family: &quot;994265_10&quot;; font-size: 14pt;"><strong><br /></strong></span></p>
<p align="center" style="padding: 0px; line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff; text-align: center;"><strong><br /></strong></p>
<p align="center" style="padding: 0px; line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff; text-align: center;"><strong><img src="http://postfiles14.naver.net/20160118_237/roboholic84_1453091039973wF7C9_PNG/%C4%B8%C3%B3.PNG?type=w1" width="450" height="449" id="20160118_237/roboholic84_1453091039973wF7C9_PNG/%C4%B8%C3%B3.PNG" alt="" class="_photoImage" data-lazy-src="" style="border: none rgb(0, 0, 0); cursor: pointer;" /></strong></p>
<p align="center" style="padding: 0px; line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff; text-align: center;"><strong><br /></strong></p>
<p align="center" style="padding: 0px; line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff; text-align: center;"><span style="font-family: &quot;994265_10&quot;; font-size: 11pt;"><strong><br /></strong></span></p>
<p align="center" style="padding: 0px; line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff; text-align: center;"><span style="font-family: &quot;994265_10&quot;; font-size: 11pt;"><strong>5핀으로 구성된 로터리 엔코더 모듈입니다. 3핀 로터리 엔코더와는 다르게 무한으로 회전이 가능하며,</strong></span></p>
<p align="center" style="padding: 0px; line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff; text-align: center;"><strong><br /></strong></p>
<p align="center" style="padding: 0px; line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff; text-align: center;"><span style="font-family: &quot;994265_10&quot;; font-size: 11pt;"><strong>그에 대한 회전운동을 전기적 신호로 변환 받을 수 있습니다.</strong></span></p>
<p align="center" style="padding: 0px; line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff; text-align: center;"><strong><br /></strong></p>
<p align="center" style="padding: 0px; line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff; text-align: center;"><span style="font-family: &quot;994265_10&quot;; font-size: 11pt;"><strong>추가적으로 푸쉬 버튼 기능도 있어 ON/OFF 스위치 기능도 사용할 수 있습니다.</strong></span></p>
<p align="center" style="padding: 0px; line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff; text-align: center;"><strong><br /></strong></p>
<p align="center" style="padding: 0px; line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff; text-align: center;"><strong><br /></strong></p>
<p align="center" style="padding: 0px; line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff; text-align: center;"><strong><span style="font-family: &quot;994265_10&quot;; font-size: 11pt;">사용&nbsp;</span><span style="font-family: &quot;994265_10&quot;; font-size: 11pt;">전압 : 5V</span></strong></p>
<p align="center" style="padding: 0px; line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff; text-align: center;"><strong><br /></strong></p>
<p align="center" style="padding: 0px; line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff; text-align: center;"><span style="font-family: &quot;994265_10&quot;; font-size: 11pt;"><strong>출력 신호 : 디지털</strong></span></p>
<p align="center" style="padding: 0px; line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff; text-align: center;"><strong><br /></strong></p>
<p align="center" style="padding: 0px; line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff; text-align: center;"><strong><img src="http://postfiles10.naver.net/20160118_201/roboholic84_1453091152957q3uDD_PNG/1.png?type=w1" width="814" height="18" id="20160118_201/roboholic84_1453091152957q3uDD_PNG/1.png" alt="" class="_photoImage" data-lazy-src="" style="border: none; cursor: pointer;" /></strong></p>
<p align="center" style="padding: 0px; line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff; text-align: center;"><strong><br /></strong></p>
<p align="left" style="padding: 0px; line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff;"><span style="color: #a6cf00; font-family: &quot;3287760_9&quot;; font-size: 18pt;"><strong>기초 실습하기</strong></span></p>
<p align="center" style="padding: 0px; line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff; text-align: center;"><strong><br /></strong></p>
<p align="center" style="padding: 0px; line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff; text-align: center;"><strong><br /></strong></p>
<p align="center" style="padding: 0px; line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff; text-align: center;"><span style="font-family: &quot;994265_10&quot;; font-size: 11pt;"><strong>우선 엔코더의 값을 시리얼 모니터로 확인해보겠습니다. 스위치 기능은 값을 초기화 시키는 용도로 사용하겠습니다.</strong></span></p>
<p align="center" style="padding: 0px; line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff; text-align: center;"><strong><br /></strong></p>
<p align="center" style="padding: 0px; line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff; text-align: center;"><strong><br /></strong></p>
<p align="center" style="padding: 0px; line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff; text-align: center;"><span style="color: #ff0000; font-family: &quot;994265_10&quot;; font-size: 18pt;"><strong>회로도</strong></span></p>
<p align="center" style="padding: 0px; line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff; text-align: center;"><strong><br /></strong></p>
<p align="center" style="padding: 0px; line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff; text-align: center;"><strong><img src="http://postfiles9.naver.net/20160118_24/roboholic84_1453092651674c7SVR_JPEG/Untitled_Sketch_bb.jpg?type=w1" width="936" height="533" id="20160118_24/roboholic84_1453092651674c7SVR_JPEG/Untitled_Sketch_bb.jpg" alt="" class="_photoImage" data-lazy-src="" style="border: none; cursor: pointer;" /></strong></p>
<p align="center" style="padding: 0px; line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff; text-align: center;"><strong><br /></strong></p>
<p align="center" style="padding: 0px; line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff; text-align: center;"><span style="font-family: &quot;994265_10&quot;; font-size: 11pt;"><strong>CLK - D2</strong></span></p>
<p align="center" style="padding: 0px; line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff; text-align: center;"><span style="font-family: &quot;994265_10&quot;; font-size: 11pt;"><strong>DT - D3</strong></span></p>
<p align="center" style="padding: 0px; line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff; text-align: center;"><span style="font-family: &quot;994265_10&quot;; font-size: 11pt;"><strong>SW - D4</strong></span></p>
<p align="center" style="padding: 0px; line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff; text-align: center;"><span style="font-family: &quot;994265_10&quot;; font-size: 11pt;"><strong>(+) - 5V</strong></span></p>
<p align="center" style="padding: 0px; line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff; text-align: center;"><span style="font-family: &quot;994265_10&quot;; font-size: 11pt;"><strong>GND - GND</strong></span></p>
<p align="center" style="padding: 0px; line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff; text-align: center;"><strong><br /></strong></p>
<p align="center" style="padding: 0px; line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff; text-align: center;"><strong><br /></strong></p>
<p align="center" style="padding: 0px; line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff; text-align: center;"><span style="color: #ff0000; font-family: &quot;994265_10&quot;; font-size: 14pt;"><strong>소스 코드</strong></span></p>
<p align="center" style="padding: 0px; line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff; text-align: center;"><strong><br /></strong></p>
<div align="center" style="line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff;">
   <table class="__se_tbl" border="1" cellspacing="0" cellpadding="0" style="border-collapse: separate; border-width: 2px 2px 0px 0px; border-style: dashed dashed none none; border-color: #e97d81 rgb(233, 125, 129) currentcolor currentcolor; border-image: none 100% / 1 / 0 stretch;">
      <tbody>
         <tr>
            <td width="741" style="word-break: break-all; border-width: 0px 0px 2px 2px; border-style: none none dashed dashed; border-color: currentcolor currentcolor rgb(233, 125, 129) rgb(233, 125, 129); border-image: none 100% / 1 / 0 stretch;">
               <p style="padding: 0px; line-height: 1.5;"><span style="font-family: &quot;994265_10&quot;; font-size: 11pt;"><strong>&nbsp;// 소스 파일은 encoder_1 로 첨부하였습니다.</strong></span></p>
               <pre><font color="#5e6d03">#define</font><font color="#000000">clpin</font><font color="#000000">2</font><font color="#5e6d03">#define</font><font color="#000000">dtpin</font><font color="#000000">3</font><font color="#5e6d03">#define</font><font color="#000000">swpin</font><font color="#000000">4</font><font color="#00979c">int</font><font color="#000000">encoderVal</font><font color="#434f54">=</font><font color="#000000">0</font><font color="#000000">;</font><font color="#00979c">static</font><font color="#00979c">int</font><font color="#000000">oldA</font><font color="#434f54">=</font><font color="#00979c">HIGH</font><font color="#000000">;</font><font color="#00979c">static</font><font color="#00979c">int</font><font color="#000000">oldB</font><font color="#434f54">=</font><font color="#00979c">HIGH</font><font color="#000000">;</font><font color="#00979c">void</font><font color="#5e6d03">setup</font><font color="#000000">(</font><font color="#000000">)</font><font color="#000000">{</font>
 &nbsp;<font color="#d35400">pinMode</font><font color="#000000">(</font><font color="#000000">clpin</font><font color="#434f54">,</font><font color="#00979c">INPUT</font><font color="#000000">)</font><font color="#000000">;</font>
 &nbsp;<font color="#d35400">pinMode</font><font color="#000000">(</font><font color="#000000">dtpin</font><font color="#434f54">,</font><font color="#00979c">INPUT</font><font color="#000000">)</font><font color="#000000">;</font>
 &nbsp;<font color="#d35400">pinMode</font><font color="#000000">(</font><font color="#000000">swpin</font><font color="#434f54">,</font><font color="#00979c">INPUT</font><font color="#000000">)</font><font color="#000000">;</font>
 &nbsp;<font color="#d35400">digitalWrite</font><font color="#000000">(</font><font color="#000000">swpin</font><font color="#434f54">,</font><font color="#00979c">HIGH</font><font color="#000000">)</font><font color="#000000">;</font>
 &nbsp;<b><font color="#d35400">Serial</font></b><font color="#434f54">.</font><font color="#d35400">begin</font><font color="#000000">(</font><font color="#000000">9600</font><font color="#000000">)</font><font color="#000000">;</font><font color="#000000">}</font><font color="#00979c">void</font><font color="#5e6d03">loop</font><font color="#000000">(</font><font color="#000000">)</font><font color="#000000">{</font>
 &nbsp;<font color="#00979c">int</font><font color="#000000">change</font><font color="#434f54">=</font><font color="#000000">getEncoderTurn</font><font color="#000000">(</font><font color="#000000">)</font><font color="#000000">;</font>
 &nbsp;<font color="#000000">encoderVal</font><font color="#434f54">=</font><font color="#000000">encoderVal</font><font color="#434f54">+</font><font color="#000000">change</font><font color="#000000">;</font>
 &nbsp;<font color="#5e6d03">if</font><font color="#000000">(</font><font color="#d35400">digitalRead</font><font color="#000000">(</font><font color="#000000">swpin</font><font color="#000000">)</font><font color="#434f54">==</font><font color="#00979c">LOW</font><font color="#000000">)</font>
 &nbsp;<font color="#000000">{</font>
 &nbsp;&nbsp;&nbsp;<font color="#000000">encoderVal</font><font color="#434f54">=</font><font color="#000000">0</font><font color="#000000">;</font>
 &nbsp;<font color="#000000">}</font>
 &nbsp;<b><font color="#d35400">Serial</font></b><font color="#434f54">.</font><font color="#d35400">println</font><font color="#000000">(</font><font color="#000000">encoderVal</font><font color="#000000">)</font><font color="#000000">;</font><font color="#000000">}</font><font color="#00979c">int</font><font color="#000000">getEncoderTurn</font><font color="#000000">(</font><font color="#00979c">void</font><font color="#000000">)</font><font color="#000000">{</font>
 &nbsp;<font color="#00979c">int</font><font color="#000000">result</font><font color="#434f54">=</font><font color="#000000">0</font><font color="#000000">;</font>
 &nbsp;<font color="#00979c">int</font><font color="#000000">newA</font><font color="#434f54">=</font><font color="#d35400">digitalRead</font><font color="#000000">(</font><font color="#000000">clpin</font><font color="#000000">)</font><font color="#000000">;</font>
 &nbsp;<font color="#00979c">int</font><font color="#000000">newB</font><font color="#434f54">=</font><font color="#d35400">digitalRead</font><font color="#000000">(</font><font color="#000000">dtpin</font><font color="#000000">)</font><font color="#000000">;</font>
 &nbsp;<font color="#5e6d03">if</font><font color="#000000">(</font><font color="#000000">newA</font><font color="#434f54">!=</font><font color="#000000">oldA</font><font color="#434f54">||</font><font color="#000000">newB</font><font color="#434f54">!=</font><font color="#000000">oldB</font><font color="#000000">)</font>
 &nbsp;<font color="#000000">{</font>
 &nbsp;&nbsp;&nbsp;<font color="#5e6d03">if</font><font color="#000000">(</font><font color="#000000">oldA</font><font color="#434f54">==</font><font color="#00979c">HIGH</font><font color="#434f54">&amp;&amp;</font><font color="#000000">newA</font><font color="#434f54">==</font><font color="#00979c">LOW</font><font color="#000000">)</font>
 &nbsp;&nbsp;&nbsp;<font color="#000000">{</font>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#000000">result</font><font color="#434f54">=</font><font color="#000000">(</font><font color="#000000">oldB</font><font color="#434f54">*</font><font color="#000000">2</font><font color="#434f54">-</font><font color="#000000">1</font><font color="#000000">)</font><font color="#000000">;</font>
 &nbsp;&nbsp;&nbsp;<font color="#000000">}</font>
 &nbsp;<font color="#000000">}</font>
 &nbsp;<font color="#000000">oldA</font><font color="#434f54">=</font><font color="#000000">newA</font><font color="#000000">;</font>
 &nbsp;<font color="#000000">oldB</font><font color="#434f54">=</font><font color="#000000">newB</font><font color="#000000">;</font>
 &nbsp;<font color="#5e6d03">return</font><font color="#000000">result</font><font color="#000000">;</font><font color="#000000">}</font></pre>
               <p style="padding: 0px; line-height: 1.5;">&nbsp;</p>
               </td>
            </tr>
         </tbody>
      </table>
   </div>
<p align="center" style="padding: 0px; line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff; text-align: center;"><strong><br /></strong></p>
<p align="center" style="padding: 0px; line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff; text-align: center;"><strong><br /></strong></p>
<p align="center" style="padding: 0px; line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff; text-align: center;"><strong><img src="http://postfiles5.naver.net/20160118_52/roboholic84_1453092917065igcq9_PNG/1.png?type=w1" width="741" height="16" id="20160118_52/roboholic84_1453092917065igcq9_PNG/1.png" alt="" class="_photoImage" data-lazy-src="" style="border: none rgb(0, 0, 0); cursor: pointer;" /></strong></p>
<p align="center" style="padding: 0px; line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff; text-align: center;"><strong><br /></strong></p>
<p align="left" style="padding: 0px; line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff;"><span style="color: #a6cf00; font-family: &quot;3287760_9&quot;; font-size: 18pt;"><strong>동영상 및 후기</strong></span></p>
<p align="center" style="padding: 0px; line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff; text-align: center;"><strong><br /></strong></p>
<p align="center" style="padding: 0px; line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff; text-align: center;"><strong><br /></strong></p>
<p align="center" style="padding: 0px; line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff; text-align: center;"><span style="font-family: &quot;994265_10&quot;; font-size: 11pt;"><strong>시계방향으로 돌리면 값이 증가하고, 시계 반대 방향으로 돌리면 값이 감소합니다.</strong></span></p>
<p align="center" style="padding: 0px; line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff; text-align: center;"><strong><br /></strong></p>
<p align="center" style="padding: 0px; line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff; text-align: center;"><strong><span style="font-family: &quot;994265_10&quot;; font-size: 11pt;">한 바퀴가 20이므로 출력값</span><span style="font-family: &quot;994265_10&quot;; font-size: 11pt;">&nbsp;</span><span style="font-family: &quot;994265_10&quot;; font-size: 11pt;">/&nbsp;</span><span style="font-family: &quot;994265_10&quot;; font-size: 11pt;">20 을 하시면&nbsp;회전&nbsp;</span><span style="font-family: &quot;994265_10&quot;; font-size: 11pt;">수도 구할 수 있습니다.</span></strong></p>
<p align="center" style="padding: 0px; line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff; text-align: center;"><strong><span style="font-family: &quot;994265_10&quot;; font-size: 11pt;"></span></strong></p>
<p align="center" style="padding: 0px; line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff; text-align: center;"><strong><span style="font-family: &quot;994265_10&quot;; font-size: 11pt;"></span></strong></p>
<p align="center" style="padding: 0px; line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff; text-align: center;"><strong><span style="color: #ff0000; font-family: &quot;994265_10&quot;; font-size: 14pt;">동영</span></strong><strong><span style="color: #ff0000; font-family: &quot;994265_10&quot;; font-size: 14pt;">상</span></strong></p>
<p align="center" style="padding: 0px; line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff; text-align: center;"><strong><span style="font-family: &quot;994265_10&quot;; font-size: 11pt;"><br /></span></strong></p>
<p align="center" style="padding: 0px; line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff; text-align: center;"><iframe src="http://serviceapi.nmv.naver.com/view/ugcPlayer.nhn?vid=3D2FF0E04BA465E22DA87E48F7778B839E76&amp;inKey=V123dfc000300b373d8c15d241b37b14007b5477c59669ca48c2bba1d44dd66e812a75d241b37b14007b5&amp;hasLink=1" frameborder="0" height="438" width="720" scrolling="no" allowfullscreen=""></iframe></p>
<p align="center" style="padding: 0px; line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff; text-align: center;"><strong><span style="font-family: &quot;994265_10&quot;; font-size: 11pt;"></span></strong></p>
<p align="center" style="padding: 0px; line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff; text-align: center;"><span style="font-family: &quot;994265_10&quot;; font-size: 11pt;"><strong><br /></strong></span></p>
<p align="center" style="padding: 0px; line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff; text-align: center;"><span style="font-family: &quot;994265_10&quot;; font-size: 11pt;"><strong>손잡이 부분을 누르면 푸쉬</strong><strong>버튼처럼&nbsp;</strong></span><strong><span style="font-family: &quot;994265_10&quot;; font-size: 11pt;">클릭이 되며,&nbsp;해당 소스 코드에서는&nbsp;값을 초기화시킵니다.</span></strong></p>
<p align="center" style="padding: 0px; line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff; text-align: center;"><strong><br /></strong></p>
<p align="center" style="padding: 0px; line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff; text-align: center;"><strong><img src="http://postfiles3.naver.net/20160118_146/roboholic84_1453093362736gYNwi_PNG/1.png?type=w1" width="814" height="18" id="20160118_146/roboholic84_1453093362736gYNwi_PNG/1.png" alt="" class="_photoImage" data-lazy-src="" style="border: none; cursor: pointer;" /></strong></p>
<p align="center" style="padding: 0px; line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff; text-align: center;"><strong><br /></strong></p>
<p align="left" style="padding: 0px; line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff;"><span style="color: #a6cf00; font-family: &quot;3287760_9&quot;; font-size: 18pt;"><strong>응용 실습하기</strong></span></p>
<p align="center" style="padding: 0px; line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff; text-align: center;"><strong><br /></strong></p>
<p align="center" style="padding: 0px; line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff; text-align: center;"><strong><br /></strong></p>
<p align="center" style="padding: 0px; line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff; text-align: center;"><strong><span style="font-family: &quot;994265_10&quot;; font-size: 11pt;">else if 문을 사용하여&nbsp;</span><span style="font-family: &quot;994265_10&quot;; font-size: 11pt;">엔코더의 값에 따른 LED 색을 깜빡이게&nbsp;</span><span style="font-family: &quot;994265_10&quot;; font-size: 11pt;">하겠</span><span style="font-family: &quot;994265_10&quot;; font-size: 11pt;">습니다.</span></strong></p>
<p align="center" style="padding: 0px; line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff; text-align: center;"><strong><br /></strong></p>
<p align="center" style="padding: 0px; line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff; text-align: center;"><strong><br /></strong></p>
<p align="center" style="padding: 0px; line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff; text-align: center;"><span style="color: #ff0000; font-family: &quot;994265_10&quot;; font-size: 14pt;"><strong>회로도</strong></span></p>
<p align="center" style="padding: 0px; line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff; text-align: center;"><strong><br /></strong></p>
<p align="center" style="padding: 0px; line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff; text-align: center;"><strong><br /></strong></p>
<p align="center" style="padding: 0px; line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff; text-align: center;"><strong><img src="http://postfiles12.naver.net/20160118_299/roboholic84_1453099287405FGBmy_JPEG/4.jpg?type=w1" width="936" height="595" id="20160118_299/roboholic84_1453099287405FGBmy_JPEG/4.jpg" alt="" class="_photoImage" data-lazy-src="" style="border: none; cursor: pointer;" /></strong></p>
<p align="center" style="padding: 0px; line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff; text-align: center;"><strong><br /></strong></p>
<p align="center" style="padding: 0px; line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff; text-align: center;"><strong><br /></strong></p>
<p align="center" style="padding: 0px; line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff; text-align: center;"><strong><br /></strong></p>
<p align="center" style="padding: 0px; line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff; text-align: center;"><span style="color: #ff0000; font-family: &quot;994265_10&quot;; font-size: 14pt;"><strong>소스 코드</strong></span></p>
<p align="center" style="padding: 0px; line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff; text-align: center;"><strong><br /></strong></p>
<div align="center" style="line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff;">
   <table class="__se_tbl" border="1" cellspacing="0" cellpadding="0" style="border-collapse: separate; border-width: 2px 2px 0px 0px; border-style: dashed dashed none none; border-color: #e97d81 rgb(233, 125, 129) currentcolor currentcolor; border-image: none 100% / 1 / 0 stretch;">
      <tbody>
         <tr>
            <td width="741" style="word-break: break-all; border-width: 0px 0px 2px 2px; border-style: none none dashed dashed; border-color: currentcolor currentcolor rgb(233, 125, 129) rgb(233, 125, 129); border-image: none 100% / 1 / 0 stretch;">
               <p style="padding: 0px; line-height: 1.5;"><span style="font-family: &quot;994265_10&quot;; font-size: 11pt;"><strong>&nbsp;// 소스 파일은 encoder_2로 첨부하였습니다.</strong></span></p>
               <pre><font color="#5e6d03">#define</font><font color="#000000">clpin</font><font color="#000000">2</font><font color="#5e6d03">#define</font><font color="#000000">dtpin</font><font color="#000000">3</font><font color="#5e6d03">#define</font><font color="#000000">swpin</font><font color="#000000">4</font><font color="#00979c">int</font><font color="#000000">LED1</font><font color="#434f54">=</font><font color="#000000">11</font><font color="#000000">;</font><font color="#00979c">int</font><font color="#000000">LED2</font><font color="#434f54">=</font><font color="#000000">12</font><font color="#000000">;</font><font color="#00979c">int</font><font color="#000000">LED3</font><font color="#434f54">=</font><font color="#000000">13</font><font color="#000000">;</font><font color="#00979c">int</font><font color="#000000">encoderVal</font><font color="#434f54">=</font><font color="#000000">0</font><font color="#000000">;</font><font color="#00979c">static</font><font color="#00979c">int</font><font color="#000000">oldA</font><font color="#434f54">=</font><font color="#00979c">HIGH</font><font color="#000000">;</font><font color="#00979c">static</font><font color="#00979c">int</font><font color="#000000">oldB</font><font color="#434f54">=</font><font color="#00979c">HIGH</font><font color="#000000">;</font><font color="#00979c">void</font><font color="#5e6d03">setup</font><font color="#000000">(</font><font color="#000000">)</font><font color="#000000">{</font>
 &nbsp;<font color="#d35400">pinMode</font><font color="#000000">(</font><font color="#000000">clpin</font><font color="#434f54">,</font><font color="#00979c">INPUT</font><font color="#000000">)</font><font color="#000000">;</font>
 &nbsp;<font color="#d35400">pinMode</font><font color="#000000">(</font><font color="#000000">dtpin</font><font color="#434f54">,</font><font color="#00979c">INPUT</font><font color="#000000">)</font><font color="#000000">;</font>
 &nbsp;<font color="#d35400">pinMode</font><font color="#000000">(</font><font color="#000000">swpin</font><font color="#434f54">,</font><font color="#00979c">INPUT</font><font color="#000000">)</font><font color="#000000">;</font>
 &nbsp;<font color="#d35400">digitalWrite</font><font color="#000000">(</font><font color="#000000">swpin</font><font color="#434f54">,</font><font color="#00979c">HIGH</font><font color="#000000">)</font><font color="#000000">;</font><font color="#000000">}</font><font color="#00979c">void</font><font color="#5e6d03">loop</font><font color="#000000">(</font><font color="#000000">)</font><font color="#000000">{</font>
 &nbsp;<font color="#00979c">int</font><font color="#000000">change</font><font color="#434f54">=</font><font color="#000000">getEncoderTurn</font><font color="#000000">(</font><font color="#000000">)</font><font color="#000000">;</font>
 &nbsp;<font color="#000000">encoderVal</font><font color="#434f54">=</font><font color="#000000">encoderVal</font><font color="#434f54">+</font><font color="#000000">change</font><font color="#000000">;</font>
 &nbsp;<font color="#5e6d03">if</font><font color="#000000">(</font><font color="#d35400">digitalRead</font><font color="#000000">(</font><font color="#000000">swpin</font><font color="#000000">)</font><font color="#434f54">==</font><font color="#00979c">LOW</font><font color="#000000">)</font>
 &nbsp;<font color="#000000">{</font>
 &nbsp;&nbsp;&nbsp;<font color="#000000">encoderVal</font><font color="#434f54">=</font><font color="#000000">0</font><font color="#000000">;</font>
 &nbsp;<font color="#000000">}</font>
 &nbsp;
<font color="#5e6d03">if</font><font color="#000000">(</font><font color="#000000">(</font><font color="#000000">encoderVal</font><font color="#000000">)</font><font color="#434f54">&lt;=</font><font color="#434f54">-</font><font color="#000000">10</font><font color="#000000">)</font><font color="#434f54">// -10보다 작다면</font><font color="#000000">{</font>
 &nbsp;<font color="#d35400">digitalWrite</font><font color="#000000">(</font><font color="#000000">LED1</font><font color="#434f54">,</font><font color="#00979c">HIGH</font><font color="#000000">)</font><font color="#000000">;</font>
 &nbsp;<font color="#d35400">digitalWrite</font><font color="#000000">(</font><font color="#000000">LED2</font><font color="#434f54">,</font><font color="#00979c">LOW</font><font color="#000000">)</font><font color="#000000">;</font>
 &nbsp;<font color="#d35400">digitalWrite</font><font color="#000000">(</font><font color="#000000">LED3</font><font color="#434f54">,</font><font color="#00979c">LOW</font><font color="#000000">)</font><font color="#000000">;</font><font color="#000000">}</font><font color="#5e6d03">else</font><font color="#5e6d03">if</font><font color="#000000">(</font><font color="#000000">(</font><font color="#000000">encoderVal</font><font color="#000000">)</font><font color="#434f54">&lt;</font><font color="#000000">10</font><font color="#000000">)</font><font color="#434f54">//10보다 작다면</font><font color="#000000">{</font><font color="#d35400">digitalWrite</font><font color="#000000">(</font><font color="#000000">LED1</font><font color="#434f54">,</font><font color="#00979c">LOW</font><font color="#000000">)</font><font color="#000000">;</font><font color="#d35400">digitalWrite</font><font color="#000000">(</font><font color="#000000">LED2</font><font color="#434f54">,</font><font color="#00979c">HIGH</font><font color="#000000">)</font><font color="#000000">;</font><font color="#d35400">digitalWrite</font><font color="#000000">(</font><font color="#000000">LED3</font><font color="#434f54">,</font><font color="#00979c">LOW</font><font color="#000000">)</font><font color="#000000">;</font><font color="#000000">}</font><font color="#5e6d03">else</font> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#434f54">// 둘다 아니다면</font><font color="#000000">{</font>
 &nbsp;<font color="#d35400">digitalWrite</font><font color="#000000">(</font><font color="#000000">LED1</font><font color="#434f54">,</font><font color="#00979c">LOW</font><font color="#000000">)</font><font color="#000000">;</font> 
 &nbsp;<font color="#d35400">digitalWrite</font><font color="#000000">(</font><font color="#000000">LED2</font><font color="#434f54">,</font><font color="#00979c">LOW</font><font color="#000000">)</font><font color="#000000">;</font>
 &nbsp;<font color="#d35400">digitalWrite</font><font color="#000000">(</font><font color="#000000">LED3</font><font color="#434f54">,</font><font color="#00979c">HIGH</font><font color="#000000">)</font><font color="#000000">;</font><font color="#000000">}</font><font color="#000000">}</font><font color="#00979c">int</font><font color="#000000">getEncoderTurn</font><font color="#000000">(</font><font color="#00979c">void</font><font color="#000000">)</font><font color="#000000">{</font>
 &nbsp;<font color="#00979c">int</font><font color="#000000">result</font><font color="#434f54">=</font><font color="#000000">0</font><font color="#000000">;</font>
 &nbsp;<font color="#00979c">int</font><font color="#000000">newA</font><font color="#434f54">=</font><font color="#d35400">digitalRead</font><font color="#000000">(</font><font color="#000000">clpin</font><font color="#000000">)</font><font color="#000000">;</font>
 &nbsp;<font color="#00979c">int</font><font color="#000000">newB</font><font color="#434f54">=</font><font color="#d35400">digitalRead</font><font color="#000000">(</font><font color="#000000">dtpin</font><font color="#000000">)</font><font color="#000000">;</font>
 &nbsp;<font color="#5e6d03">if</font><font color="#000000">(</font><font color="#000000">newA</font><font color="#434f54">!=</font><font color="#000000">oldA</font><font color="#434f54">||</font><font color="#000000">newB</font><font color="#434f54">!=</font><font color="#000000">oldB</font><font color="#000000">)</font>
 &nbsp;<font color="#000000">{</font>
 &nbsp;&nbsp;&nbsp;<font color="#5e6d03">if</font><font color="#000000">(</font><font color="#000000">oldA</font><font color="#434f54">==</font><font color="#00979c">HIGH</font><font color="#434f54">&amp;&amp;</font><font color="#000000">newA</font><font color="#434f54">==</font><font color="#00979c">LOW</font><font color="#000000">)</font>
 &nbsp;&nbsp;&nbsp;<font color="#000000">{</font>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#000000">result</font><font color="#434f54">=</font><font color="#000000">(</font><font color="#000000">oldB</font><font color="#434f54">*</font><font color="#000000">2</font><font color="#434f54">-</font><font color="#000000">1</font><font color="#000000">)</font><font color="#000000">;</font>
 &nbsp;&nbsp;&nbsp;<font color="#000000">}</font>
 &nbsp;<font color="#000000">}</font>
 &nbsp;<font color="#000000">oldA</font><font color="#434f54">=</font><font color="#000000">newA</font><font color="#000000">;</font>
 &nbsp;<font color="#000000">oldB</font><font color="#434f54">=</font><font color="#000000">newB</font><font color="#000000">;</font>
 &nbsp;<font color="#5e6d03">return</font><font color="#000000">result</font><font color="#000000">;</font><font color="#000000">}</font></pre>
               <p style="padding: 0px; line-height: 1.5;">&nbsp;</p>
               </td>
            </tr>
         </tbody>
      </table>
   </div>
<p align="center" style="padding: 0px; line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff; text-align: center;"><strong><br /></strong></p>
<p align="center" style="padding: 0px; line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff; text-align: center;"><strong><br /></strong></p>
<p align="center" style="padding: 0px; line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff; text-align: center;"><strong><span style="font-family: &quot;994265_10&quot;; font-size: 11pt;">else if에 대해 자세히 알고 싶으시다면&nbsp;&nbsp;</span><span style="font-family: &quot;994265_10&quot;; font-size: 11pt;">&gt;&gt;&nbsp;</span></strong><a class="con_link" href="http://blog.naver.com/roboholic84/220309363592" target="_blank" style="text-decoration-line: none; overflow-wrap: break-word;"><span style="font-family: &quot;994265_10&quot;; font-size: 11pt;"><strong>여기</strong></span></a><span style="font-family: &quot;994265_10&quot;; font-size: 11pt;"><strong>&nbsp;&lt;&lt;를 클릭하시면 이동됩니다.</strong></span></p>
<p align="center" style="padding: 0px; line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff; text-align: center;"><strong><br /></strong></p>
<p align="center" style="padding: 0px; line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff; text-align: center;"><strong><img src="http://postfiles5.naver.net/20160118_132/roboholic84_1453099994216nLiwx_PNG/1.png?type=w1" width="814" height="18" id="20160118_132/roboholic84_1453099994216nLiwx_PNG/1.png" alt="" class="_photoImage" data-lazy-src="" style="border: none; cursor: pointer;" /></strong></p>
<p align="center" style="padding: 0px; line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff; text-align: center;"><strong><br /></strong></p>
<p align="left" style="padding: 0px; line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff;"><span style="color: #a6cf00; font-family: &quot;3287760_9&quot;; font-size: 18pt;"><strong>동영상 및 후기</strong></span></p>
<p align="center" style="padding: 0px; line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff; text-align: center;"><strong><br /></strong></p>
<p align="center" style="padding: 0px; line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff; text-align: center;"><span style="color: #ff0000; font-family: &quot;994265_10&quot;; font-size: 14pt;"><strong>동영상</strong></span></p>
<p align="center" style="padding: 0px; line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff; text-align: center;"><strong><br /></strong></p>
<p align="center" style="padding: 0px; line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff; text-align: center;"><strong><iframe src="http://serviceapi.nmv.naver.com/view/ugcPlayer.nhn?vid=3EA5EA8F86A4BF1626CEB4F05058DF1EE12B&amp;inKey=V121a0771865944267d3c909de1f3d56a1de79863af9eb9756e521c51a518e900023e909de1f3d56a1de7&amp;hasLink=1" frameborder="0" height="438" width="720" scrolling="no" allowfullscreen=""></iframe></strong></p>
<p align="center" style="padding: 0px; line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff; text-align: center;"><strong><span style="font-family: &quot;994265_10&quot;; font-size: 11pt;"></span></strong></p>
<p align="center" style="padding: 0px; line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff; text-align: center;"><strong><span style="font-family: &quot;994265_10&quot;; font-size: 11pt;">앞서 말씀드린 듯이 스위치 손잡이 부분을 누르면 초기화가 되며</span></strong></p>
<p align="center" style="padding: 0px; line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff; text-align: center;"><strong><span style="font-family: &quot;994265_10&quot;; font-size: 11pt;"></span></strong></p>
<p align="center" style="padding: 0px; line-height: 1.5; color: #464646; font-family: 돋움; background-color: #ffffff; text-align: center;"><strong><span style="font-family: &quot;994265_10&quot;; font-size: 11pt;">-10보다 작거나 같으면 노란색 , -10보다 작거나 같지 않고 10보다 작으면 흰색, 둘 다 아니면&nbsp;빨간색을 켭니다.</span></strong></p>
<p></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<div class="autosourcing-stub-extra" style="line-height: 1.5; zoom: 1; opacity: 1;">
   <p style="margin: 11px 0px 7px; padding: 0px; line-height: 1.5; font-size: 12px; font-family: Dotum; font-style: normal; font-weight: normal;"><strong><strong style="padding: 0px 7px 0px 0px;">[출처]</strong><span>&nbsp;</span><a href="http://blog.naver.com/roboholic84/220601110190" target="_blank" style="text-decoration: none;">5핀 무한회전 로터리 엔코더 모듈 사용하기 (회전 각 측정)(Keyes)(Rotation)(if,else if,else)[아두이노 강좌]</a><span style="padding: 0px 7px 0px 5px;">|</span><strong style="padding: 0px 7px 0px 0px;">작성자</strong><span>&nbsp;</span><a href="http://blog.naver.com/roboholic84" target="_blank" style="text-decoration: none;">오픈랩</a>`</strong></p>
   </div>