0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

APPTVRepeater (ESP8266) > ソフトウェア v0.3 > リモコン登録完了

Last updated at Posted at 2017-09-23
動作確認
- ESP-WROOM-02 (以下、ESP8266)
- ユニーバサル基板実装
- Arduino IDE 1.6.6
- Canon IXY 3

開始: ESP8266 > 検討 > APPTVRepeater > 英語リスニング補助ツール (定数時間の巻き戻し機能)

APPTVRepeater (ESP8266) > ソフトウェア v0.1, v0.2 > 上ボタン押下の送信は成功
の続き。

リモコンの登録

Apple TVの
設定 > 一般 > リモコン > リモコンを追加 > 開始
にて
上、下、左、右、SELECT、MENU
を順番に長押しする。

上記のコードを実装した。

コード v0.3

esp8266_170923_APPTVrepeater
# include <ESP8266WiFi.h>
# include "AppleRemoteSender.h"

/*
 * v0.3 Sep. 23, 2017
 *   - send keys to register ESP8266 remote controller to Apple TV
 * v0.2 Sep. 23, 2017
 *   - send UP signal to register the remote controller
 * v0.1 Sep. 23, 2017
 *   - turn on/off the IR pin to check the device
 */

static const int kPinIR = 4;

# define KEY_MENU 0x01
# define KEY_PLAY 0x02
# define KEY_RIGHT 0x03
# define KEY_LEFT 0x04
# define KEY_UP 0x05
# define KEY_DOWN 0x06

void setup() {
  WiFi.disconnect(); // watch dog reset対処
  Serial.begin(115200);
  pinMode(kPinIR, OUTPUT);

  APPTV_setup(kPinIR);
}

static const int keylist[] = {
  KEY_UP,
  KEY_DOWN,
  KEY_LEFT,
  KEY_RIGHT,
  KEY_PLAY, // SELECT
  KEY_MENU,
};

void RegisterController(void)
{
  static int pos = 0;
  
  int size_key = sizeof(keylist) / sizeof(keylist[0]);
  
  delay(2000); // msec

  if (pos >= 0) {
    Serial.println(F("Send Key")); // F() to reduce RAM usage  
    for(int loop=0; loop < 20; loop++) {
      APPTV_SendKey(kPinIR, keylist[pos]);
      delay(100); // msec
    }
    pos++;
    if (pos == size_key) {
      pos = -1;
    }
  }
}

void loop() {
  static int pos = 0;
  int size_key = sizeof(keylist) / sizeof(keylist[0]);
  
  delay(2000); // msec

  RegisterController();  
}

登録完了

上記を実行して、登録を完了した。

リモコン名は「ESP8266」とした。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?