<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ko">
		<id>http://lhdangerous.godohosting.com/wiki/index.php?action=history&amp;feed=atom&amp;title=Raspberry_pi_%EC%97%90%EC%84%9C_python%EC%9C%BC%EB%A1%9C_GPIO_%EC%82%AC%EC%9A%A9%ED%95%98%EA%B8%B0</id>
		<title>Raspberry pi 에서 python으로 GPIO 사용하기 - 편집 역사</title>
		<link rel="self" type="application/atom+xml" href="http://lhdangerous.godohosting.com/wiki/index.php?action=history&amp;feed=atom&amp;title=Raspberry_pi_%EC%97%90%EC%84%9C_python%EC%9C%BC%EB%A1%9C_GPIO_%EC%82%AC%EC%9A%A9%ED%95%98%EA%B8%B0"/>
		<link rel="alternate" type="text/html" href="http://lhdangerous.godohosting.com/wiki/index.php?title=Raspberry_pi_%EC%97%90%EC%84%9C_python%EC%9C%BC%EB%A1%9C_GPIO_%EC%82%AC%EC%9A%A9%ED%95%98%EA%B8%B0&amp;action=history"/>
		<updated>2026-04-18T10:35:19Z</updated>
		<subtitle>이 문서의 편집 역사</subtitle>
		<generator>MediaWiki 1.28.2</generator>

	<entry>
		<id>http://lhdangerous.godohosting.com/wiki/index.php?title=Raspberry_pi_%EC%97%90%EC%84%9C_python%EC%9C%BC%EB%A1%9C_GPIO_%EC%82%AC%EC%9A%A9%ED%95%98%EA%B8%B0&amp;diff=260&amp;oldid=prev</id>
		<title>2019년 9월 14일 (토) 03:01에 Doguin님의 편집</title>
		<link rel="alternate" type="text/html" href="http://lhdangerous.godohosting.com/wiki/index.php?title=Raspberry_pi_%EC%97%90%EC%84%9C_python%EC%9C%BC%EB%A1%9C_GPIO_%EC%82%AC%EC%9A%A9%ED%95%98%EA%B8%B0&amp;diff=260&amp;oldid=prev"/>
				<updated>2019-09-14T03:01:21Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;a href=&quot;http://lhdangerous.godohosting.com/wiki/index.php?title=Raspberry_pi_%EC%97%90%EC%84%9C_python%EC%9C%BC%EB%A1%9C_GPIO_%EC%82%AC%EC%9A%A9%ED%95%98%EA%B8%B0&amp;amp;diff=260&amp;amp;oldid=199&quot;&gt;차이 보기&lt;/a&gt;</summary>
		<author><name>Doguin</name></author>	</entry>

	<entry>
		<id>http://lhdangerous.godohosting.com/wiki/index.php?title=Raspberry_pi_%EC%97%90%EC%84%9C_python%EC%9C%BC%EB%A1%9C_GPIO_%EC%82%AC%EC%9A%A9%ED%95%98%EA%B8%B0&amp;diff=199&amp;oldid=prev</id>
		<title>2018년 6월 7일 (목) 18:43에 Doguin님의 편집</title>
		<link rel="alternate" type="text/html" href="http://lhdangerous.godohosting.com/wiki/index.php?title=Raspberry_pi_%EC%97%90%EC%84%9C_python%EC%9C%BC%EB%A1%9C_GPIO_%EC%82%AC%EC%9A%A9%ED%95%98%EA%B8%B0&amp;diff=199&amp;oldid=prev"/>
				<updated>2018-06-07T18:43:07Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;tr style='vertical-align: top;' lang='ko'&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← 이전 판&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;2018년 6월 7일 (목) 18:43 판&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l5&quot; &gt;5번째 줄:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;5번째 줄:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;## 기본 사용법&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;## 기본 사용법&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* 먼저 모듈을 임포트한다. (필수)&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* 먼저 모듈을 임포트한다. (필수)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;``` python&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;``` python&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;import RPi.GPIO as GPIO&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;import RPi.GPIO as GPIO&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;```&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;```&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* 핀 넘버를 부르는 방식을 선택한다.(필수)&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* 핀 넘버를 부르는 방식을 선택한다.(필수)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;``` python&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;``` python&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Doguin</name></author>	</entry>

	<entry>
		<id>http://lhdangerous.godohosting.com/wiki/index.php?title=Raspberry_pi_%EC%97%90%EC%84%9C_python%EC%9C%BC%EB%A1%9C_GPIO_%EC%82%AC%EC%9A%A9%ED%95%98%EA%B8%B0&amp;diff=198&amp;oldid=prev</id>
		<title>2018년 6월 7일 (목) 18:36에 Doguin님의 편집</title>
		<link rel="alternate" type="text/html" href="http://lhdangerous.godohosting.com/wiki/index.php?title=Raspberry_pi_%EC%97%90%EC%84%9C_python%EC%9C%BC%EB%A1%9C_GPIO_%EC%82%AC%EC%9A%A9%ED%95%98%EA%B8%B0&amp;diff=198&amp;oldid=prev"/>
				<updated>2018-06-07T18:36:21Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;tr style='vertical-align: top;' lang='ko'&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← 이전 판&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;2018년 6월 7일 (목) 18:36 판&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot; &gt;1번째 줄:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;1번째 줄:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# 라즈베리파이에서 파이썬으로 GPIO 사용하기&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# 라즈베리파이에서 파이썬으로 GPIO 사용하기&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;@(4_skills)&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;raspberry pi 에서&amp;#160; Python으로 GPIO 제어하기 위해서 사용하는 모듈은 **RPi.GPIO** . 참고로 C를 사용한다면 **WiringPi** 라이브러리를 사용해 Arduino와 비슷하게 사용할 수도 있다.&amp;#160; 여기서는 RPi.GPIO모듈을 사용해 Python으로 GPIO제어토록 해보자.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;raspberry pi 에서&amp;#160; Python으로 GPIO 제어하기 위해서 사용하는 모듈은 **RPi.GPIO** . 참고로 C를 사용한다면 **WiringPi** 라이브러리를 사용해 Arduino와 비슷하게 사용할 수도 있다.&amp;#160; 여기서는 RPi.GPIO모듈을 사용해 Python으로 GPIO제어토록 해보자.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Doguin</name></author>	</entry>

	<entry>
		<id>http://lhdangerous.godohosting.com/wiki/index.php?title=Raspberry_pi_%EC%97%90%EC%84%9C_python%EC%9C%BC%EB%A1%9C_GPIO_%EC%82%AC%EC%9A%A9%ED%95%98%EA%B8%B0&amp;diff=197&amp;oldid=prev</id>
		<title>Doguin: 새 문서: # 라즈베리파이에서 파이썬으로 GPIO 사용하기 @(4_skills) raspberry pi 에서  Python으로 GPIO 제어하기 위해서 사용하는 모듈은 **RPi.GPIO** . 참고로...</title>
		<link rel="alternate" type="text/html" href="http://lhdangerous.godohosting.com/wiki/index.php?title=Raspberry_pi_%EC%97%90%EC%84%9C_python%EC%9C%BC%EB%A1%9C_GPIO_%EC%82%AC%EC%9A%A9%ED%95%98%EA%B8%B0&amp;diff=197&amp;oldid=prev"/>
				<updated>2018-06-07T18:36:05Z</updated>
		
		<summary type="html">&lt;p&gt;새 문서: # 라즈베리파이에서 파이썬으로 GPIO 사용하기 @(4_skills) raspberry pi 에서  Python으로 GPIO 제어하기 위해서 사용하는 모듈은 **RPi.GPIO** . 참고로...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;새 문서&lt;/b&gt;&lt;/p&gt;&lt;div&gt;# 라즈베리파이에서 파이썬으로 GPIO 사용하기&lt;br /&gt;
@(4_skills)&lt;br /&gt;
raspberry pi 에서  Python으로 GPIO 제어하기 위해서 사용하는 모듈은 **RPi.GPIO** . 참고로 C를 사용한다면 **WiringPi** 라이브러리를 사용해 Arduino와 비슷하게 사용할 수도 있다.  여기서는 RPi.GPIO모듈을 사용해 Python으로 GPIO제어토록 해보자.&lt;br /&gt;
&lt;br /&gt;
## 기본 사용법&lt;br /&gt;
* 먼저 모듈을 임포트한다. (필수)&lt;br /&gt;
``` python&lt;br /&gt;
import RPi.GPIO as GPIO&lt;br /&gt;
```&lt;br /&gt;
* 핀 넘버를 부르는 방식을 선택한다.(필수)&lt;br /&gt;
``` python&lt;br /&gt;
GPIO.setmode(GPIO.BOARD)&lt;br /&gt;
#or&lt;br /&gt;
GPIO.setmode(GPIO.BCM)&lt;br /&gt;
```&lt;br /&gt;
GPIO.BOARD 는 라즈베리파이에 배열된 순서대로 핀 이름을 부르겠다는 의미이고, GPIO.BCM은 (Broadcom chip-specific pin numbers) 로  Broadcom SOC 칩에서 사용하는 핀이름을 사용하겠다는 의미.&lt;br /&gt;
즉, GPIO.BOARD 모드에서 8번핀은 GPIO.BCM  모드에서 14번 핀과 동일하다.&lt;br /&gt;
![Raspberry Pi GPIO 배치](https://cdn.sparkfun.com/r/600-600/assets/learn_tutorials/4/2/4/header_pinout.jpg)&lt;br /&gt;
&lt;br /&gt;
* 핀 모드를 설정한다. 아두이노에서 `pinMode()` 와 같은 역할.(필수)&lt;br /&gt;
``` python&lt;br /&gt;
GPIO.setup(18, GPIO.OUT)&lt;br /&gt;
#or&lt;br /&gt;
GPIO.setup(18, GPIO.IN)&lt;br /&gt;
```&lt;br /&gt;
list를 사용해 한번에 여러 핀을 설정 할 수도 있고, output 모드로 설정하는 경우 초기값을 줄 수도 있다.&lt;br /&gt;
``` python&lt;br /&gt;
GPIO.setup([18, 19, 20], GPIO.OUT, initial=GPIO.HIGH)&lt;br /&gt;
```&lt;br /&gt;
input 모드로 설정하는 경우, 필요에 따라 내장 pull-up, pull-down 저항을 사용할 수도 있다.&lt;br /&gt;
``` python&lt;br /&gt;
GPIO.setup(18, GPIO.IN, pull_up_down = GPIO.PUD_UP)&lt;br /&gt;
#or&lt;br /&gt;
GPIO.setup(18, GPIO.IN, pull_up_down = GPIO.PUD_DOWN)&lt;br /&gt;
```&lt;br /&gt;
* digital output&lt;br /&gt;
``` python&lt;br /&gt;
import time&lt;br /&gt;
&lt;br /&gt;
GPIO.output(18, GPIO.HIGH)&lt;br /&gt;
time.sleep(0.1)	# 100 millisecond 딜레이&lt;br /&gt;
GPIO.output(18,GPIO.LOW)&lt;br /&gt;
```&lt;br /&gt;
`GPIO.HIGH` 대신 `True `나 `1`을 써도 좋다. `GPIO.LOW` 대신에는 `False`나 `0`&lt;br /&gt;
&lt;br /&gt;
* analog output (pwm)&lt;br /&gt;
RPi는 기본적으로 2개의 hardware PWM 채널을 가지고 있는데, 아쉽게도 RPi.GPIO에서는 사용할 방법이 없다. (C로 wiringPi를 사용하는경우 1개 채널(GPIO18) 사용가능.) 대신 software PWM을 어느 핀에서든 사용할 수 있다. 동시에 여러개도 가능하다.(참고:https://www.raspberrypi.org/forums/viewtopic.php?f=44&amp;amp;t=31714)&lt;br /&gt;
``` python&lt;br /&gt;
#swPWM 초기화&lt;br /&gt;
myPwm = GPIO.PWM(18, 1000) # pin, frequency&lt;br /&gt;
myPwm.start(50) #dutycycle (0~100사이 값). 아두이노로 치면 analogWrite(18, 128)과 동일.&lt;br /&gt;
&lt;br /&gt;
# 출력값 변경&lt;br /&gt;
myPwm.ChangeDutyCycle(75)&lt;br /&gt;
&lt;br /&gt;
#swPWM 정지&lt;br /&gt;
myPwm.stop()&lt;br /&gt;
```&lt;br /&gt;
* digital input&lt;br /&gt;
``` python&lt;br /&gt;
pin_read = GPIO.input(18)	#True / False&lt;br /&gt;
```&lt;br /&gt;
* analog input&lt;br /&gt;
안타깝게도 라즈베리파이는 analog input이 불가능하다. ADC(analog-digital converter)회로가 필요하다. **MCP3008**을 사용하도록 하자. (참고: https://learn.adafruit.com/reading-a-analog-in-and-controlling-audio-volume-with-the-raspberry-pi/overview) 혹은 간이로 만들수도 있다(참고: https://www.allaboutcircuits.com/projects/building-raspberry-pi-controllers-part-5-reading-analog-data-with-an-rpi/)&lt;br /&gt;
&lt;br /&gt;
* 프로그램을 종료하기전, 리소스를 반납한다. (필수)&lt;br /&gt;
``` python&lt;br /&gt;
GPIO.cleanup()&lt;br /&gt;
```&lt;br /&gt;
&lt;br /&gt;
## 참고&lt;br /&gt;
RPi.GPIO wiki: https://sourceforge.net/p/raspberry-gpio-python/wiki/BasicUsage/&lt;br /&gt;
https://learn.sparkfun.com/tutorials/raspberry-gpio&lt;br /&gt;
http://studymake.tistory.com/498&lt;br /&gt;
&lt;br /&gt;
[[category:raspberry pi]]&lt;/div&gt;</summary>
		<author><name>Doguin</name></author>	</entry>

	</feed>