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

NanoH2をZigbee電球[205.474.95]のcolorリモコンにする

1
Last updated at Posted at 2026-06-14

参考

  • 元ネタ

いろいろ注意

  • 過去ログも見よ!!!
  • m5nanoh2,nano h2,m5stack nanoh2の事
  • ikea home smart と言うらしい
  • 書き込み後、なんか、抜き差ししたら動いた。
  • ペアリングも忘れずに!!!

結果

動いた

Screenshot From 2026-06-14 18-00-06.png

Screenshot From 2026-06-14 18-03-44.png

image_original(112).jpg

image_original(113).jpg

image_original(114).jpg

Screenshot From 2026-06-14 18-05-52.png

プログラム



//net_zigbee_test_led3_m5nanoh2_1


//受信以外は、エラー
#ifndef ZIGBEE_MODE_ZCZR
#error "Zigbee end device mode is not selected in Tools->Zigbee mode"
#endif


//インクルド
#include "Zigbee.h"  //ジグビー


//定義 カラー調光器のスイッチ
ZigbeeColorDimmerSwitch zb_switch = ZigbeeColorDimmerSwitch(1);


//初期化
void setup() {

  //シリアルポートの開始
  Serial.begin(115200);

  Zigbee.addEndpoint(&zb_switch);  //エンドポイントの追加
  Zigbee.setRebootOpenNetwork(180);

  //ジグビーの開始
  Serial.println();
  Serial.println("Zigbee.begin()");
  if (!Zigbee.begin(ZIGBEE_COORDINATOR)) {

    Serial.println("Zigbee.begin() failed");
    abort();

  }  //endif


  //バインドされているか?
  Serial.println("Waiting for binding");
  while (!zb_switch.bound()) {

    Serial.print(".");
    delay(500);  //0.5秒待つ

  }  //while
  Serial.print("\n");

}  //setup


//メインループ
void loop() {

  //バインドされているか?
  if (!zb_switch.bound()) {

    return;

  }  //endif



  zb_switch.setLightColor(255,0,0);delay(3000); // r

  zb_switch.setLightColor(0,255,0);delay(3000); // g

  zb_switch.setLightColor(0,0,255);delay(3000); // b

 
  //zb_switch.setLightLevel(0);delay(3000); // 0%
  //zb_switch.setLightLevel(33);delay(3000); // 33%
  //zb_switch.setLightLevel(66);delay(3000); // 66%
  //zb_switch.setLightLevel(100);delay(3000); // 100%

  //zb_switch.lightToggle();  //スイッチをトグルする
  //delay(3000);  //3秒待つ

  //ライトの状態を切り替え
  //zb_switch.lightOn();
  //delay(3000);

  // ライトの状態を切り替え
  //zb_switch.lightOff();
  //delay(3000);

}  //loop



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