我想让我的房子看起来像一所使用 obniz 扬声器的学校......

1.在家工作时注意力集中的问题

自 2020 年春天的电晕灾难开始以来,已经过去了三年。
在冠状病毒大流行之后,我开始在家工作,并且已经习惯了每周在家工作三天和每周工作两天。
但是,有一个问题不容易解决。
有时在家工作时过于集中有东西。

专注力很好。但是,过度集中对身体不利。
眨眼的次数减少,眼睛会干涩,如果长时间保持相同的姿势,肩膀和腰部会受伤。
当我还是学生的时候,时间表是固定的,我被迫休息,
只要您是社会的一员,您就必须自己管理它。
最近学习了LINE bot等。让您的家看起来像学校的钟声我决定尝试创建一个 .

2. 我想创造什么

这是我想要创建的:
① 按下 obniz 开关
②定时器启动 LED 亮灯。
(3) 定时器启动铃声响起。
④ 25分钟测量
⑤ 结束消息声音
  ⑥发送您使用计时器的LINE消息

但是,仅仅发出声音太简单了,所以我决定向 LINE bot 发送消息,记录计时器的使用历史。

3. 可交付成果

1. 视频

当我按下开关时,我成功发出铃声,但在那之后,消息没有发送到 LINE 机器人。为什么?#protoout #linedc #obniz #初学者 皮c。山雀河。 Kom/OhJeeycq7x

— 菊(@AYE7WvdouqRwaNp)2022 年 10 月 30 日 2.Node-RED配置 ![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2885686/8be64513-92f0-d626-304c-56a3c008f61f.png)

当按下 obniz 开关时,obniz 功能设置为响铃。
然后向 LINE bot 发送消息

[{"id":"8d99087367318605","type":"obniz-repeat","z":"7d6595294aad5cca","obniz":"3b943a226fd3d359","name":"","interval":"100","code":"msg.payload = await obniz.switch.getWait();

return msg;","x":390,"y":260,"wires":[["0a8a66409c28d8f3"]]},{"id":"0a8a66409c28d8f3","type":"obniz-function","z":"7d6595294aad5cca","obniz":"3b943a226fd3d359","name":"","code":"obniz.display.clear(); // 画面を消去
if (msg.payload === 'push') {
 obniz.display.print('start');
 // 赤: rgbled.rgb(255, 0, 0);
 // 緑: rgbled.rgb(0, 255, 0);
 // 青: rgbled.rgb(0, 0, 255);
 
 obnizParts.WS2811.rgb(0, 255, 0);
 await obniz.wait(300); // led ON for 0.3sec.
 obnizParts.WS2811.rgb(0, 0, 0)
 await obniz.wait(150)
 
 obnizParts.WS2811.rgb(0, 255, 0);
 await obniz.wait(300); // led ON for 0.3sec.
 obnizParts.WS2811.rgb(0, 0, 0)
 await obniz.wait(150)
 
 obnizParts.WS2811.rgb(0, 255, 0);
 await obniz.wait(300); // led ON for 0.3sec.
 obnizParts.WS2811.rgb(0, 0, 0)
 await obniz.wait(150)
 
 obniz.display.clear(); // 画面を消去
 
 //前半
 obnizParts.Speaker.play(698.456);//ファ
 await obniz.wait(500);
 obnizParts.Speaker.stop();
 await obniz.wait(200);
 
 obnizParts.Speaker.play(880.000);//ラ
 await obniz.wait(500);
 obnizParts.Speaker.stop(); 
 await obniz.wait(200);

 obnizParts.Speaker.play(783.991);//ソ
 await obniz.wait(500)
 obnizParts.Speaker.stop(); 
 await obniz.wait(200);

 obnizParts.Speaker.play(523.251);//ド
 await obniz.wait(1000);
 obnizParts.Speaker.stop(); 
 await obniz.wait(200); 
 
 obnizParts.Speaker.play(698.456);//ファ
 await obniz.wait(500);
 obnizParts.Speaker.stop();
 await obniz.wait(200);
 
 obnizParts.Speaker.play(783.991);//ソ
 await obniz.wait(500)
 obnizParts.Speaker.stop(); 
 await obniz.wait(200);
 
  obnizParts.Speaker.play(880.000);//ラ
 await obniz.wait(500);
 obnizParts.Speaker.stop(); 
 await obniz.wait(200);
 
 obnizParts.Speaker.play(698.456);//ファ
 await obniz.wait(1000);
 obnizParts.Speaker.stop();
 await obniz.wait(200);
 
 //後半
 obnizParts.Speaker.play(880.000);//ラ
 await obniz.wait(500);
 obnizParts.Speaker.stop(); 
 await obniz.wait(200);
 
 obnizParts.Speaker.play(698.456);//ファ
 await obniz.wait(500);
 obnizParts.Speaker.stop();
 await obniz.wait(200);
 
 obnizParts.Speaker.play(783.991);//ソ
 await obniz.wait(500)
 obnizParts.Speaker.stop(); 
 await obniz.wait(200);

 obnizParts.Speaker.play(523.251);//ド
 await obniz.wait(1000);
 obnizParts.Speaker.stop(); 
 await obniz.wait(200);
 
 obnizParts.Speaker.play(523.251);//ド
 await obniz.wait(500);
 obnizParts.Speaker.stop(); 
 await obniz.wait(200);
 
 obnizParts.Speaker.play(783.991);//ソ
 await obniz.wait(500);
 obnizParts.Speaker.stop(); 
 await obniz.wait(200);
 
 obnizParts.Speaker.play(880.00);//ラ
 await obniz.wait(500);
 obnizParts.Speaker.stop();
 await obniz.wait(200);
 
 obnizParts.Speaker.play(698.456);//ファ
 await obniz.wait(1000);
 obnizParts.Speaker.stop();
 await obniz.wait(200); 
 
 obnizParts.Speaker.play(698.456);//ファ
 await obniz.wait(1500);
 obnizParts.Speaker.stop();
 await obniz.wait(200); 
 
 await obniz.wait(2000);//ミリ秒単位で設定

 obniz.display.print('in the middle');

 await obniz.wait(2000);//ミリ秒単位で設定
 
 obniz.display.clear(); // 画面を消去
 obniz.display.print('end')

 obnizParts.Speaker.play(698.456);//ファ
 await obniz.wait(1500);
 obnizParts.Speaker.stop()
}else{
    
}
 ","x":600,"y":260,"wires":[["a52014f8d7bc3969"]]},{"id":"a52014f8d7bc3969","type":"delay","z":"7d6595294aad5cca","name":"","pauseType":"delay","timeout":"50","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":800,"y":280,"wires":[["9bf58c9ae8e6a9b4"]]},{"id":"9bf58c9ae8e6a9b4","type":"BloadcastMessage","z":"7d6595294aad5cca","name":"","x":790,"y":360,"wires":[[]]},{"id":"3b943a226fd3d359","type":"obniz","obnizId":"","deviceType":"obnizboard1y","name":"","accessToken":"","code":"obniz.display.clear(); // 画面を消去
obnizParts.Speaker = obniz.wired("Speaker",{ signal:0, gnd:1 });

//obnizParts.led = obniz.wired('LED', { anode:3, cathode:4 });

obnizParts.WS2811 = obniz.wired('WS2811', { gnd:3, vcc:4, din:5 });
obnizParts.WS2811.rgb(0, 0, 0)
 "}] 	

*为了操作确认,设置为2秒后结束,25分钟不测量。

4. 我不能做的事

我使用上述配置创建了它,但我无法向 LINE bot 发送消息。
我尝试了“将节点设置为“PUSHMessage””、“重新创建 LINE bot 本身”和“重新发布令牌”,但无法解决问题。

五、总结

在这篇文章中,我想使用 obniz 的扬声器让它看起来像一所学校,但我无意中向 LINE 机器人发送了一条消息。
我假设设置有问题,但我无法找出原因。
在重试之前,我想了解更多关于 LINE 和 obniz 的信息。


原创声明:本文系作者授权爱码网发表,未经许可,不得转载;

原文地址:https://www.likecs.com/show-308632387.html

相关文章: