This kit comes with a module that can receive and send infrared signals.
Many home appliances powered by remote controls use infrared rays to send signals, so obniz can receive and store these signals.
If you send the saved signal from obniz again, you can output the signal of the saved remote control, so you can operate the air conditioner at home from your smartphone on the go.
Receive
A lot of infrared rays are flying around us. There are even remote controls.
However, even if they use the same infrared rays, the contents sent using them are different so that the air conditioner does not turn on without permission even if the remote control of the TV is used.
obniz's infrared module can capture many infrared signals as they are.
There is a block for receiving infrared signals.
This block will stop the program and wait until one of the infrared rays arrives.
This is useful. It will wait for you, so you can receive it by bringing the remote control when you are waiting and pressing the button to memorize the infrared rays you want to remember.
But how do you save the received signal?
The received signal will be a large number. We can't write on paper.
But,the block program will be terminated when the screen is closed, so the acquired data will also be lost.
There is a block to store in the cloud. Let's use it and save it to the obniz cloud.Then you can retrieve it again by closing the program.
You must be logged in to the cloud to save to the cloud. Create an account from [Sign up] (https://console.obniz.com/users/signin) and "register" for obniz.
There is a block in the "Kit" that can store this infrared signal in the cloud.
By inserting the previous block as the saved data of this block,
The moment you receive it, it will be automatically saved in the cloud.
This way, you can reopen the program and retrieve what you saved from the cloud.
You can give it a name when you save it.This time, It will remember the infrared signal of the electric fan by the name of "power supply". It will look like the image below
Receive and save when button is pressed
Let's receive it first.
Prepare a button, and when the button is pressed, set it to infrared reception, and when it receives it, save it with the name "power".
Then, when it is received, the label "Received" is displayed so that it is easy to tell whether or not it has been received.
Let's run this program and press the button to receive it.
Point the remote control you want to remember around the green base on the kit and press the button you want to remember.
When "Received" is displayed on the screen, the save is successful!
Send
Sending is very easy.
All you have to do is take out the memorized signal and send it from infrared rays.
First is the part that retrieves data from the cloud. The block is "Load signal" from iothome kit "in" Kit ".
I decided to save it under the name "Power", so when I take it out, I also take it out with "Power".
By attaching this block to the block for transmitting infrared rays, you will be able to transmit.
Also prepare a send button so that you can send it when you press it.
The completed program looks like this.
When you do this, you will see two buttons.
If you receive it earlier, it is saved in the cloud, so you don't have to receive it anymore.
Let's press send to emit infrared rays.
If that doesn't work, try changing the location or orientation of your IoT Home Kit, or try receiving it again.