When the box is opened, a birthday song is played and the original message is displayed on the browser screen.
This is an example of a production of IoT Home Kit
- obniz Board
- power supply
- distance sensor
- outer box（Large enough to hold the IoT Home Kit）
(All but the outer box is included with the IoT Home Kit!)
How to make
Assemble the IoT Home Kit and place it inside the outer box, with the distance sensor facing up.
Put the lid on the outer box, and the preparation is complete.
The distance sensor measures the distance from the lid.
In lines 3 to 6, we prepare to output the message to the browser screen.
The label variable is a variable that displays the specified letters and numbers on the screen.
Lines 4 and 6 set an empty character in the label variable. There is no output on the screen.
(If you don’t set an empty character, the character label will be printed on the screen.)
The distance sensor will continue to measure the distance from the lid in the “Run all the way” block after line 6.
In the ” if” block, if the sensor distance is greater than 20cm (when the lid is opened), the label variable is rewritten.
A message saying “Happy Birthday to You” is output on the browser screen, and a birthday song (Happy Birthday) is played.
As soon as the song ends, the following message will be output. Try to make the content of your message unique to that special someone.