<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ja">
	<id>https://mochiu.net/index.php?action=history&amp;feed=atom&amp;title=Arduino%E3%81%AE%E5%9F%BA%E7%A4%8E_-_%E3%82%B8%E3%82%A7%E3%82%B9%E3%83%81%E3%83%A3%E3%82%BB%E3%83%B3%E3%82%B5</id>
	<title>Arduinoの基礎 - ジェスチャセンサ - 版の履歴</title>
	<link rel="self" type="application/atom+xml" href="https://mochiu.net/index.php?action=history&amp;feed=atom&amp;title=Arduino%E3%81%AE%E5%9F%BA%E7%A4%8E_-_%E3%82%B8%E3%82%A7%E3%82%B9%E3%83%81%E3%83%A3%E3%82%BB%E3%83%B3%E3%82%B5"/>
	<link rel="alternate" type="text/html" href="https://mochiu.net/index.php?title=Arduino%E3%81%AE%E5%9F%BA%E7%A4%8E_-_%E3%82%B8%E3%82%A7%E3%82%B9%E3%83%81%E3%83%A3%E3%82%BB%E3%83%B3%E3%82%B5&amp;action=history"/>
	<updated>2026-06-04T05:37:00Z</updated>
	<subtitle>このウィキのこのページに関する変更履歴</subtitle>
	<generator>MediaWiki 1.43.8</generator>
	<entry>
		<id>https://mochiu.net/index.php?title=Arduino%E3%81%AE%E5%9F%BA%E7%A4%8E_-_%E3%82%B8%E3%82%A7%E3%82%B9%E3%83%81%E3%83%A3%E3%82%BB%E3%83%B3%E3%82%B5&amp;diff=4433&amp;oldid=prev</id>
		<title>Wiki: 文字列「source lang」を「syntaxhighlight lang」に置換</title>
		<link rel="alternate" type="text/html" href="https://mochiu.net/index.php?title=Arduino%E3%81%AE%E5%9F%BA%E7%A4%8E_-_%E3%82%B8%E3%82%A7%E3%82%B9%E3%83%81%E3%83%A3%E3%82%BB%E3%83%B3%E3%82%B5&amp;diff=4433&amp;oldid=prev"/>
		<updated>2021-11-22T06:07:18Z</updated>

		<summary type="html">&lt;p&gt;文字列「source lang」を「syntaxhighlight lang」に置換&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;ja&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← 古い版&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;2021年11月22日 (月) 15:07時点における版&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-l26&quot;&gt;26行目:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;26行目:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;正常に動作すると、手を振った方向にあるLEDが点灯する。&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;正常に動作すると、手を振った方向にあるLEDが点灯する。&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; 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;  &amp;lt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;source &lt;/del&gt;lang=&quot;c++&quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; 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;lt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;syntaxhighlight &lt;/ins&gt;lang=&quot;c++&quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  #include &amp;lt;Wire.h&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  #include &amp;lt;Wire.h&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  #include &amp;lt;SparkFun_APDS9960.h&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  #include &amp;lt;SparkFun_APDS9960.h&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Wiki</name></author>
	</entry>
	<entry>
		<id>https://mochiu.net/index.php?title=Arduino%E3%81%AE%E5%9F%BA%E7%A4%8E_-_%E3%82%B8%E3%82%A7%E3%82%B9%E3%83%81%E3%83%A3%E3%82%BB%E3%83%B3%E3%82%B5&amp;diff=4341&amp;oldid=prev</id>
		<title>Wiki: 文字列「&lt;/source&gt;」を「&lt;/syntaxhighlight&gt;」に置換</title>
		<link rel="alternate" type="text/html" href="https://mochiu.net/index.php?title=Arduino%E3%81%AE%E5%9F%BA%E7%A4%8E_-_%E3%82%B8%E3%82%A7%E3%82%B9%E3%83%81%E3%83%A3%E3%82%BB%E3%83%B3%E3%82%B5&amp;diff=4341&amp;oldid=prev"/>
		<updated>2021-11-15T20:51:34Z</updated>

		<summary type="html">&lt;p&gt;文字列「&amp;lt;/source&amp;gt;」を「&amp;lt;/syntaxhighlight&amp;gt;」に置換&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;ja&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← 古い版&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;2021年11月16日 (火) 05:51時点における版&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-l112&quot;&gt;112行目:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;112行目:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     digitalWrite( ledPin, LOW );&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     digitalWrite( ledPin, LOW );&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  }&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; 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=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; 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;  &amp;lt;/&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;source&lt;/del&gt;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; 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;lt;/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;syntaxhighlight&lt;/ins&gt;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;__FORCETOC__&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;__FORCETOC__&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[カテゴリ:Arduino]]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[カテゴリ:Arduino]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Wiki</name></author>
	</entry>
	<entry>
		<id>https://mochiu.net/index.php?title=Arduino%E3%81%AE%E5%9F%BA%E7%A4%8E_-_%E3%82%B8%E3%82%A7%E3%82%B9%E3%83%81%E3%83%A3%E3%82%BB%E3%83%B3%E3%82%B5&amp;diff=1756&amp;oldid=prev</id>
		<title>Wiki: ページの作成:「== 概要 == ここでは、Arduinoでジェスチャセンサ(APDS-9960)を使用する方法を記載する。&lt;br&gt; 実際に、上下左右にLEDを配置して、ジ…」</title>
		<link rel="alternate" type="text/html" href="https://mochiu.net/index.php?title=Arduino%E3%81%AE%E5%9F%BA%E7%A4%8E_-_%E3%82%B8%E3%82%A7%E3%82%B9%E3%83%81%E3%83%A3%E3%82%BB%E3%83%B3%E3%82%B5&amp;diff=1756&amp;oldid=prev"/>
		<updated>2020-07-29T08:12:51Z</updated>

		<summary type="html">&lt;p&gt;ページの作成:「== 概要 == ここでは、Arduinoでジェスチャセンサ(APDS-9960)を使用する方法を記載する。&amp;lt;br&amp;gt; 実際に、上下左右にLEDを配置して、ジ…」&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新規ページ&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== 概要 ==&lt;br /&gt;
ここでは、Arduinoでジェスチャセンサ(APDS-9960)を使用する方法を記載する。&amp;lt;br&amp;gt;&lt;br /&gt;
実際に、上下左右にLEDを配置して、ジェスチャセンサの前で手を上下左右に振った方向にあるLEDを点灯させる。&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Arduinoは5[V]で動作するが、APDS-9960は3[V]〜3.8[V]で動作するので、&amp;lt;br&amp;gt;&lt;br /&gt;
もし、Arduinoクローンを使用している場合は、接続するために双方向レベルシフタが必要な可能性が高い。&amp;lt;br&amp;gt;&lt;br /&gt;
双方向レベルシフタの接続において、3.3[V]側、5[V]側、それぞれに電源を接続して、レベルシフトする線同士を同じチャネルに接続するだけである。&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
また、APDS-9960は、GY-9960LLCというモジュールで駆動させている。&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
ピンアウトは下図の通り、電源(VIN)とGND、I2Cインターフェイス(SCLとSDA)およびび割り込みピンである。&amp;lt;br&amp;gt;&lt;br /&gt;
I2Cインターフェイスは、Arduino UNOであればA4(SDA)とA5(SCL)、Arduino Megaであれば20(SDA)と21(SCL)に接続する。&amp;lt;br&amp;gt;&lt;br /&gt;
また、I2Cインターフェイスは、10[kΩ]程度の抵抗でプルアップする。&amp;lt;br&amp;gt;&lt;br /&gt;
[[ファイル:Arduino Gesture Sensor 1.png|フレームなし|中央]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
割り込みピンは、Arduino UnoではD2(割り込み番号 : 0)である。&amp;lt;br&amp;gt;&lt;br /&gt;
詳細は、[[Arduinoの基礎#.E5.89.B2.E3.82.8A.E8.BE.BC.E3.81.BF.E3.81.A8ISR|Arduinoの基礎の&amp;quot;割り込みとISR&amp;quot;セクション]]を参照すること。&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
また、LEDの電流制限抵抗は、220[Ω]とする。&amp;lt;br&amp;gt;&lt;br /&gt;
[[ファイル:Arduino Gesture Sensor 2.png|フレームなし|中央]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== サンプルコード ==&lt;br /&gt;
サンプルコードでは、SparkfunのAPDS-9960ライブラリを使用している。&amp;lt;br&amp;gt;&lt;br /&gt;
Arduino IDEのライブラリマネージャから&amp;lt;code&amp;gt;9960&amp;lt;/code&amp;gt;で検索して、ライブラリをインストールすること。&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
正常に動作すると、手を振った方向にあるLEDが点灯する。&amp;lt;br&amp;gt;&lt;br /&gt;
 &amp;lt;source lang=&amp;quot;c++&amp;quot;&amp;gt;&lt;br /&gt;
 #include &amp;lt;Wire.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;SparkFun_APDS9960.h&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 const int APDS9960_INT = 2;&lt;br /&gt;
 const int PIN_LED_RIGHT = 8;&lt;br /&gt;
 const int PIN_LED_LEFT = 9;&lt;br /&gt;
 const int PIN_LED_UP = 10;&lt;br /&gt;
 const int PIN_LED_DOWN = 11;&lt;br /&gt;
 &lt;br /&gt;
 SparkFun_APDS9960 apds = SparkFun_APDS9960();&lt;br /&gt;
 int isr_flag = 0;&lt;br /&gt;
 &lt;br /&gt;
 void setup()&lt;br /&gt;
 {&lt;br /&gt;
    Serial.begin(9600);&lt;br /&gt;
 &lt;br /&gt;
    pinMode(APDS9960_INT, INPUT);&lt;br /&gt;
 &lt;br /&gt;
    pinMode( PIN_LED_RIGHT, OUTPUT );&lt;br /&gt;
    pinMode( PIN_LED_LEFT, OUTPUT );&lt;br /&gt;
    pinMode( PIN_LED_UP, OUTPUT );&lt;br /&gt;
    pinMode( PIN_LED_DOWN, OUTPUT );&lt;br /&gt;
 &lt;br /&gt;
    digitalWrite( PIN_LED_RIGHT, LOW );&lt;br /&gt;
    digitalWrite( PIN_LED_LEFT, LOW );&lt;br /&gt;
    digitalWrite( PIN_LED_UP, LOW );&lt;br /&gt;
    digitalWrite( PIN_LED_DOWN, LOW );&lt;br /&gt;
 &lt;br /&gt;
    attachInterrupt( digitalPinToInterrupt(APDS9960_INT), interruptRoutine, FALLING);&lt;br /&gt;
 &lt;br /&gt;
    if ( !apds.init() )&lt;br /&gt;
    {&lt;br /&gt;
       Serial.println(&amp;quot;Failed to initialize APDS-9960.&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    if ( !apds.enableGestureSensor(true) )&lt;br /&gt;
    {&lt;br /&gt;
       Serial.println(&amp;quot;Could not start APDS-9960.&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void loop()&lt;br /&gt;
 {&lt;br /&gt;
    if( isr_flag == 1 )&lt;br /&gt;
    {&lt;br /&gt;
       detachInterrupt(0);&lt;br /&gt;
       handleGesture();&lt;br /&gt;
       isr_flag = 0;&lt;br /&gt;
       attachInterrupt(0, interruptRoutine, FALLING);&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void interruptRoutine()&lt;br /&gt;
 {&lt;br /&gt;
    isr_flag = 1;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void handleGesture()&lt;br /&gt;
 {&lt;br /&gt;
    if ( apds.isGestureAvailable() )&lt;br /&gt;
    {&lt;br /&gt;
       switch ( apds.readGesture() )&lt;br /&gt;
       {&lt;br /&gt;
          case DIR_UP:&lt;br /&gt;
             turnOnLED( PIN_LED_UP );&lt;br /&gt;
             break;&lt;br /&gt;
          case DIR_DOWN:&lt;br /&gt;
             turnOnLED( PIN_LED_DOWN );&lt;br /&gt;
             break;&lt;br /&gt;
          case DIR_LEFT:&lt;br /&gt;
             turnOnLED( PIN_LED_LEFT );&lt;br /&gt;
             break;&lt;br /&gt;
          case DIR_RIGHT:&lt;br /&gt;
             turnOnLED( PIN_LED_RIGHT );&lt;br /&gt;
             break;&lt;br /&gt;
       }&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void turnOnLED( int ledPin )&lt;br /&gt;
 {&lt;br /&gt;
    digitalWrite( ledPin, HIGH );&lt;br /&gt;
    delay( 1000 );&lt;br /&gt;
    digitalWrite( ledPin, LOW );&lt;br /&gt;
 }&lt;br /&gt;
 &amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__FORCETOC__&lt;br /&gt;
[[カテゴリ:Arduino]]&lt;/div&gt;</summary>
		<author><name>Wiki</name></author>
	</entry>
</feed>