2
1

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 3 years have passed since last update.

M5StickC+UIFlowで会議室の使用状況をモニタリングしよう①-1(マグネットスイッチ 準備編)

Last updated at Posted at 2021-02-27

#概要
会議室の利用状況をWeb上で把握できる仕組みを
 M5StickC+マグネットスイッチ→ThingSpeak
を使って構築しました。

UIFlowを使ったブロックプログラミングを使用したので、コードは1行も書かずに済んでいます。

下記のようにつなげて、通電時は0、切断時は1にするようにしています。
P33.JPG

#コード
UIF.JPG

M5Door.py

from m5stack import *
from m5ui import *
from uiflow import *
import machine
import time

setScreenColor(0x111111)

DoorStatus = M5Title(title="DoorStat", x=3, fgcolor=0xFFFFFF, bgcolor=0x0000FF)
L_DS = M5TextBox(3, 26, "DS", lcd.FONT_DejaVu18, 0xFFFFFF, rotate=0)

pin0 = machine.Pin(26, mode=machine.Pin.IN, pull=machine.Pin.PULL_UP)
L_DS.setText('Started!')
wait(1)
while True:
  L_DS.setText(str(pin0.value()))
  wait(1)
  wait_ms(2)

#最終版はこちら
ThingSpeakまでつなげています。
M5StickC+UIFlowで会議室の使用状況をモニタリングしよう①-2(マグネットスイッチ 完成版)

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?