Let's change the characters on the screen

It is useful to know if there are people on your smartphone from a distance.
If you put it in the bathroom, you can check from your smartphone that "Is anyone using it now?"

UILabel

In the last program, you knew if there were any people near the distance sensor.
After that, it would be nice if you could say "yes" or "not" on the screen when there are people and when there are no people.

In addition to buttons, there are labels in the "UI" block.
You can use this to display your favorite characters on the screen.

First is the block that makes the label.Doing this will create a label on the screen.
A label is a place to display characters.
This block only prepares a label on the screen, and you cannot set what characters are displayed there.

Characters are displayed on the label created using the block below.

We will use these two.

Program

The program connects to obniz, sets up iothomekit, and then creates a label.

Then, in the loop, if there is something near the sensor, change the labeled text to "Something!".On the contrary, if nothing is near, "No" will be displayed.

Then it becomes such a program.

We will try it. Then, "Not" will be displayed on the screen.
Stand in front of the sensor or cover it with your hand.Then, "Something is there!" Will be displayed on your smartphone or PC.

This is IoT, over the internet. You can use it even if you are not nearby.
When you want to know if there is anyone, such as in the bathroom or in your room, you can check it remotely by running the program.

関連の質問