狠狠撸

狠狠撸Share a Scribd company logo
Arduino
     紅外線遙控

       Cooper Maa

德明 Arduino 開發經驗分享 - 2011
Arduino
          ARRRR, /
/ DWEE, just say "do we“ fast /
       / NO, as in no.


”ARRR-DWEE-NO”
What is Arduino?
? Open Source   + Software IDE + Community
  Hardware
What is for today?
?   接收紅外線訊號
?   A Simple DIY IR Decoder
?   發射紅外線訊號
?   DIY Keypad Remote Control
Infrared Remote Control
? 非常普遍使用的無線通訊
? 用於電視、冷氣、DVD Player、MP3 Player, 玩
  具遙控車等各種設備的控制
Arduino & IRRemote
? With Arduino & IRRemote Library, you can
  make your own infrared applications.
What you need?
? First, you need an Arduino board and an
  USB cable
What you need?
? Second, you need Arduino IDE to write
  program
What you need?
? Third, an infrared receiver and a 940 nm
  Infrared LED (a.k.a Infrared Emitter)
What you need?
? Last, download and install IRRemote
  Library: http://goo.gl/2HKLm
Make sure things work
? Load "File > Examples > 1.Basics > Blink"
Examples used in this opentalk
? For your convenience, the examples used
  in this opentalk has been uploaded to
  google doc, you can download the
  examples from the following url:

       http://goo.gl/KSOu6
What is for today?
?   接收紅外線訊號
?   A Simple DIY IR Decoder
?   發射紅外線訊號
?   DIY Keypad Remote Control
接收紅外線訊號
? The wiring:
接收紅外線訊號
? Load "File > Sketchbook > IRRemoteExamples > Example1_1"
接收紅外線訊號
? Try your remote:
接收紅外線訊號
? Open Serial Monitor and see the result:
Four steps to receive Infrared signals
 1. 引用 IRRemote 函式庫:
   #include <IRremote.h>

 2. 建立 IRrecv 物件及 decode_results變數:
   const int irReceiverPin = 2; // 紅外線接收器 VOUT 腳位
   IRrecv irrecv(irReceiverPin); // 用來接收紅外線訊號
   decode_results results;       // 用來存放解碼結果

 3. 啟動紅外線解碼:
   irrecv.enableIRIn();      // 啟動紅外線解碼

 4. 檢查有沒收到紅外線:
   if (irrecv.decode(&results)) { // 解碼成功…
decode_results structure
? The structure of decode_results
decode_results structure
? The structure of decode_results
顯示紅外線協定種類
? Load "File > Sketchbook > IRRemoteExamples > Example1_2"
顯示紅外線協定種類
? Open Serial Monitor and see the result:
Infrared LED Indicator
? Load "File > Sketchbook > IRRemoteExamples > Example1_3v2"
Infrared LED Indicator
? The infrared LED indicator will blink when
  infrared signal is received.
What is for today?
?   接收紅外線訊號
?   A Simple DIY IR Decoder
?   發射紅外線訊號
?   DIY Keypad Remote Control
A simple DIY IR Decoder
? http://coopermaa2nd.blogspot.com/2011/03/14-lcd-ir-decoder.html
? The Wiring:
A simple DIY IR Decoder
? Load from http://goo.gl/2qFfC
A simple DIY IR Decoder
? The result of decoded infrared signals will
  shown on the LCD:
What is for today?
?   接收紅外線訊號
?   A Simple DIY IR Decoder
?   發射紅外線訊號
?   DIY Keypad Remote Control
發射紅外線訊號
? The wiring (IR LED 一定要接在 pin 3):
發射紅外線訊號
? Load "File > Sketchbook > IRRemoteExamples > Example2_1"
Three steps to send Infrared signals
1. 引用 IRRemote 函式庫:
  #include <IRremote.h>

2. 建立 IRsend 物件:
  IRsend irsend;          // 定義 IRsend 物件來發射紅外線訊號

3. 呼叫對應的 sendXXX() 函式發射紅外線訊號:
  irsend.sendNEC(0x4FB48B7, 32); // 記得換成你的紅外線編碼
DIY Keypad Remote Control
? http://coopermaa2nd.blogspot.com/2011/04/22-keypad.html
? The Wiring:
DIY Keypad Remote Control
? Load from http://goo.gl/Tr4a7
DIY Keypad Remote Control
? Now you have made a simple Remote Control
  using Keypad and just a simple infrared LED:
Questions?
References
? IRRemote 紅外線遙控教學
? 紅外線遙控原理與 NEC IR Protocol
? WinLIRC 紅外線遙控電腦

More Related Content

Arduino i rremote 1112