 Welcome back everyone! In the previous video, we learned how to interface Arduino Uno with Picto Blocks and wrote a script to control Uno Spin 13 LED. In this video, we are going to interface sensors with Uno using Picto Blocks. First, let us know what sensors are. Sensors are extremely useful devices. They detect what happens in the surrounding environment and either record it or indicate it. Today we are going to write a script to interface IR sensor with Uno and use it to control Uno Spin 13 LED. Let's begin! First, open Picto Blocks. Then connect Uno to your computer via a USB cable. Next, click on the board button in the toolbar and select its name from the drop-down menu. Then click on the connect button and select the appropriate port. Now let's connect the IR sensor to Uno. Connect the sensor's VCC pin to Uno's 5V pin using a red male-to-female jumper cable. Next, connect the sensor's ground pin to Uno's ground pin using a black male-to-female jumper cable. Then, connect the sensor's out pin to Uno's digital pin too using a green male-to-female jumper cable. Let's first write a test script for the IR sensor. Make Toby, the sprite, say out loud the sensor reading. Since we are not uploading the test code to Uno, we'll work in the stage mode. It will let you interact with the sensor in real time. First, drag and drop the when flag clicked block from the event's palette. Then drag and drop the forever block from the control palette. Next, from the looks palette, drag and drop the save block inside the forever block. Drag and drop the read digital sensor block inside the space of the save block and select IR from the drop-down menu. Now, to work with Uno in stage mode, we first need to upload a firmware to it. For that, click on the upload firmware button above the stage. Once the firmware is uploaded, click on the green flag above the stage and take your hand close to the sensor. Its signal LED will turn on and Toby will say 0. It will turn off when you take your hand away. Meanwhile, Toby will say 1. This means that the sensor is working properly. If not, you need to calibrate the sensor. You can do that by turning the potentiometer knob using a screwdriver. Now, let's move on to the script to control the LED. We'll modify the test script instead of writing a new one. Since we are going to upload the code to Uno, we need the when-rdno-uno-stats-up-head block. So, remove the when-flag-clicked block and drag and drop the when-rdno-uno-stats-up-head block above the script. Next, remove the save block. Now, the logic behind the script is that the LED should turn on when the sensor detects an object. Otherwise, it should turn off. For this, we'll use the if-else block. Go to the control palette and drag and drop it inside the forever block. Drag and drop the rate digital sensor block inside the hexagonal space of the if-else block and select IR from the drop-down menu. Next, drag and drop said digital pin-output block below the if-arm of the if-else block and set the output to low. Duplicate this block and drop it below the else arm. Then set the output to high. Our script is complete. Let's upload it to Uno. Switch to upload mode by toggling this button. Click on the upload code button to upload the code. And we are done. For now, in the next video, we'll see how we can add motion in our projects. If you have any question regarding this video, let us know in the comment section below. And if you liked this video, don't forget to give it a thumbs up. I'll see you in the next video. Bye.