LoginSignup
1
1

More than 3 years have passed since last update.

THETA Plug-in で LED を制御する

Last updated at Posted at 2020-09-10

この記事について

THETA の Plug-in を実装する際に、THETA本体のLEDを点灯させる方法をまとめます。
(自分用のメモの目的が強いですw)

THETA V の LED について

THETA VのLEDについて記載します。 Z1も同じだと思うのですが実機を持っていないのでわかりません。

LED の指定、色の指定について

LED Target

THETA V には8個のLEDが用意されています。
THETAのLED
※画像は https://theta360developers.github.io/plugin-guide/tutorialcolor/ より直リンク

Plug-in SDK では、それぞれ LedTarget.LED1LedTarget.LED8 と定義されています。
このうち、Plug-in内で自由に使用できるのはLED3LED8までです。

LED Color

この8個のLEDのうち、LED3 (Wi-FiマークのLED)については色を指定することができます。
Plug-in SDK では、LedColor.RED LedColor.GREEN LedColor.BLUE LedColor.CYAN LedColor.MAGENTA LedColor.YELLOW LedColor.WHITE として色が定義されています。

ちなみに、色の視認性はあまり良くありません。例えばCYANBLUEは区別がつきにくいです。同様にREDMAGENTAYELLOWWHITE も区別しにくいです。ざっくり「赤か青か緑か白か」くらいしか選択肢がないと考えておいたほうが無難です。

Plug-in 内でLEDを点灯・点滅・消灯させる

PluginActivity を継承したクラス(一般的にはMainActivity)にて、以下ようにメソッドを呼び出します。

LEDを点灯させる notificationLedShow

notificationLedShow(LedTarget.LED3);

引数に点灯させるLEDを指定します。なお LED3 を指定した場合は色は青となります。

LEDを消灯させる notificationLedHide

notificationLedHide(LedTarget.LED3);

引数に消灯させるLEDを指定します。

LEDを点滅させる notificationLedBlink

notificationLedBlink(LedTarget.LED3, LedColor.WHITE, 500);

引数に点灯させるLED, LEDの色, 点滅間隔(ミリ秒) を指定します。
色の指定ができますが、LED3以外のときは無視されます。
点滅間隔の有効値は 250~2000 です。

LED3 を指定の色で点灯させる notificationLed3Show

notificationLed3Show(LedColor.WHITE);

LED3 専用の点灯メソッドが用意されています。引数にLEDの色を指定します。

参考

https://theta360developers.github.io/plugin-guide/tutorialcolor/
https://theta360developers.github.io/plugin-guide/tutorialcommunication/

1
1
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
1
1