In this lesson, we will use the IoT for remote control which helps you be free from worrying about leaving the house with the lights on.
After creating a new project, click on the Simulation icon on the left side of the page to enter the Simulation page.
Enter the Simulation page and connect the LED module to D0 of the Ezblock Pi. Then connect the VCC and GND to 3.3V and GND respectively.
Return to the Programming page, and click the IoT Control icon to enter the IoT Control page.
Click the ‘+’ button to add actuators.
Click on the blank line to the right of type, and there appears actuators(for control) and sensors (for reading values). Here, we select actuators.
In Name bar, input Switch then click OK, and you will get a Switch actuator.
Note: Long press this actuator or sensor, and you can delete it.
Go back to the Programming page, get a Connect WiFi block that is used to get the Raspberry Pi connected to the network and put it into Start Category.
If the value of Switch is 1, set the LED module to 1 to light the LED, otherwise the LED will be turned off. The get Switch-1 value block comes from the IoT category and the LED module block is from the Sensor Kit category.
Now save your project, connect the Bluetooth and click Flash to compile and download the code. After that, you can disconnect the Bluetooth to let the IoT signal transfer faster.
Go to the IoT page, then click the run button, and you can control the LED remotely.