<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>OpenAirStar Inc. </title>
	<atom:link href="http://www.openairstar.com/tag/ir/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.openairstar.com</link>
	<description>We Love OpenSourceHardware!</description>
	<lastBuildDate>Tue, 19 Nov 2019 06:34:25 +0000</lastBuildDate>
	<language>ja</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=3.9.40</generator>
	<item>
		<title>IR測距モジュールをRaspberryPiで使おう</title>
		<link>http://www.openairstar.com/gp2y0a21yk/</link>
		<comments>http://www.openairstar.com/gp2y0a21yk/#comments</comments>
		<pubDate>Fri, 02 May 2014 04:40:35 +0000</pubDate>
		<dc:creator><![CDATA[syamamoto]]></dc:creator>
				<category><![CDATA[BLOG]]></category>
		<category><![CDATA[FabLib]]></category>
		<category><![CDATA[作例]]></category>
		<category><![CDATA[IR]]></category>
		<category><![CDATA[OpenAirStar]]></category>
		<category><![CDATA[RaspberryPi]]></category>
		<category><![CDATA[Wiring Pi]]></category>
		<category><![CDATA[センサ]]></category>

		<guid isPermaLink="false">http://www.openairstar.com/?p=219</guid>
		<description><![CDATA[今回は赤外線測距モジュールでは有名なSHARP製GP2Y0A21YKをRaspberryPiにつないでみます。 赤い線が4.5V-5.5Vの電源(vcc)、黒い線がアース(Ground)、黄色い線がアナログ出力(Vo)で … <a href="http://www.openairstar.com/gp2y0a21yk/"> Continue reading <span class="meta-nav">&#8594; </span></a>]]></description>
				<content:encoded><![CDATA[<p>今回は赤外線測距モジュールでは有名なSHARP製GP2Y0A21YKをRaspberryPiにつないでみます。</p>
<p><div id="attachment_220" style="width: 310px" class="wp-caption alignnone"><a href="http://www.openairstar.com/wp-content/uploads/2014/05/2V2A7163.jpg" rel="lightbox[219]"><img src="http://www.openairstar.com/wp-content/uploads/2014/05/2V2A7163-300x172.jpg" alt="GP2Y0A21YK-front" width="300" height="172" class="size-medium wp-image-220" /></a><p class="wp-caption-text">GP2Y0A21YK-front</p></div><div id="attachment_221" style="width: 310px" class="wp-caption alignnone"><a href="http://www.openairstar.com/wp-content/uploads/2014/05/2V2A7164.jpg" rel="lightbox[219]"><img src="http://www.openairstar.com/wp-content/uploads/2014/05/2V2A7164-300x174.jpg" alt="GP2Y0A21YK-back" width="300" height="174" class="size-medium wp-image-221" /></a><p class="wp-caption-text">GP2Y0A21YK-back</p></div></p>
<p>赤い線が4.5V-5.5Vの電源(vcc)、黒い線がアース(Ground)、黄色い線がアナログ出力(Vo)です。<br />
RaspberryHabuにつなぐときは黄色い線をアナログ入力に繋ぎます。今回はアナログ入力7番ピンを使いました。<br />
<div id="attachment_222" style="width: 310px" class="wp-caption alignnone"><a href="http://www.openairstar.com/wp-content/uploads/2014/05/2V2A7165.jpg" rel="lightbox[219]"><img src="http://www.openairstar.com/wp-content/uploads/2014/05/2V2A7165-300x170.jpg" alt="GP2Y0A21YK+Habu" width="300" height="170" class="size-medium wp-image-222" /></a><p class="wp-caption-text">GP2Y0A21YK+Habu</p></div></p>
<p>そしてデータシートのグラフを見ながら適当にコードを書きます。今回は距離に応じて0から7まで数字を出します。単位は特にないです。</p>
<p><a href="http://www.openairstar.com/wp-content/uploads/2014/05/IR.png" rel="lightbox[219]"><img src="http://www.openairstar.com/wp-content/uploads/2014/05/IR-233x300.png" alt="IR" width="233" height="300" class="alignnone size-medium wp-image-224" /></a></p>
<p>試しに実行してみます。<br />
<a href="http://www.openairstar.com/wp-content/uploads/2014/05/2V2A7167.jpg" rel="lightbox[219]"><img src="http://www.openairstar.com/wp-content/uploads/2014/05/2V2A7167-294x300.jpg" alt="IR-test1" width="294" height="300" class="alignnone size-medium wp-image-225" /></a></p>
<p><a href="http://www.openairstar.com/wp-content/uploads/2014/05/2V2A7168.jpg" rel="lightbox[219]"><img src="http://www.openairstar.com/wp-content/uploads/2014/05/2V2A7168-300x177.jpg" alt="IR-test2" width="300" height="177" class="alignnone size-medium wp-image-226" /></a></p>
<p>画面にAD変換された数値(spiresult)と適当に変換した結果(distance)が出ています。障害物の距離に応じて数値(0から7)が出ています。</p>
<p>これでデジタル測距器の完成です。出てくる数値は適当ですが。(ほんとに使う場合はif文の部分をもっと細かく正しい数値で作りましょう)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.openairstar.com/gp2y0a21yk/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
