 Hello everyone! In the previous video, we saw what Pictoblox is, explored its user interface and finally saw the working of some basic blocks by making a small animation. In this video, we are going to explore Pictoblox stage mode and see how we can control hardware in real time. We are also going to create a small script to make our sprite Toby jump when we press evive's tactile switch by connecting evive to the computer using a USB cable or over Bluetooth. Let's first understand what stage mode is. The stage mode is the mode of working in Pictoblox in which we can interact with the components like sensors, actuators and prototyping boards such as evive, arduino and esp32 in real time. Let's see how it works first hand. First open Pictoblox. Then connect evive to your computer via a USB cable. Click on the board button in the toolbar. A list of the boards that are compatible with Pictoblox will appear in the drop down. Boards like evive, arduino uno, mega, nano and esp32 can be programmed using Pictoblox. Select evive from the drop down. Next click on the connect button and select the appropriate serial port. You'll notice new pallets under the code tab. You can interact with evive using the blocks in these pallets. Since we are going to work in the stage mode, we must upload the firmware to the board. This will ensure the real time communication between the board and the computer. Uploading the firmware is a one time process. To do so, click on the upload firmware button. Observe that in doing so, the rx0-tx0 LED starts blinking. To check whether the firmware has successfully been uploaded or not, observe evive's screen. If evive's logo appears on the screen, it indicates success. Otherwise, retry the process. Now let's explore the new pallets. Blocks in the evive pallet allow us to control several of evive's features such as the tactile switches, slide switches, potentiometer, navigation key, touch inputs, real time clock and many others. Let's try one of these blocks. You can drop the set digital pin output block into the scripting area. This block, as the name suggests, can set the output of any digital pin as high or low in real time. By default, pin 13 is selected, which also has an LED connected to it. Click on the block to see what happens. You'll observe that pin 13 LED turns on. Similarly, to turn the LED off, select low from the drop down menu and click on the block again. The LED will turn off. Now let's move on to the actuator pallet. It lets you control actuators like the DC motors and servo motors. Let's try running a DC motor in real time using the run motor block. Select the motor to evive's motor channel 1 and attach a wheel to it. The first drop down in the block is for selecting the motor channel to which the motor is connected. In our case, it is 1. The second drop down is for changing the direction and the third is for changing the speed. As soon as you click on the block, the motor starts rotating in the selected direction at the set speed. Now to stop the motor, drag and drop the free motor block. Select free motor from the first drop down and the motor channel from the second drop down. Click on the block to stop the motor. Next is the sensor pallet. It lets you record the reading from the sensors connected to your board. You can interface various analog and digital sensors using the blocks in this pallet. The blocks in the display pallet lets you customize evive's display. Let's display a smiley on evive's screen using the display smiley block. Select the type of smiley you want to display from the first drop down and the size from the second drop down. Then enter the X and Y coordinates of the position at which you want to display the smiley. You can even set the background color and the color of the smiley using the last two drop downs. Now click on the block and watch how evive's screen becomes full of life. Next is the dabble pallet. Blocks in this pallet lets you interface your board with dabble, a project interaction and bluetooth controller app. We'll cover it in detail in the later video. For now, let's get back to our pallets. You can add even more pallets to your collection from the extension section. Before moving ahead, let's clear the scripting area. Now let's write a script to make toby our coding partner in Pictoblocks jump using evive's tactile switch. First, let's change the backdrop. Click on the choose a backdrop button and choose the blue sky backdrop from the library. Now select toby from the sprite pallet to create his script. You'll notice that toby is standing in the center of the stage and we want him to be near the bottom edge. For doing so, change his Y coordinate to minus 110 in the sprite pallet. Now go to the motion pallet. Drag and drop the glide block. Set the gliding time as 0.5 second and X and Y as 0. Now click on the block. You'll observe that toby glides in the upward direction. Now to bring him back to his initial position, we need another glide block. So duplicate the block by right clicking on it and drop it below the previous block. Change Y to minus 110. Toby's initial Y coordinate. Now click on the two blocks. You'll observe that toby can now jump. But how do we make toby jump using evive's tactile switch? By using the tactile switch block from the evive's pallet. And to check whether the tactile switch has been pressed or not, we are going to use an if block from the control pallet. Drop it around the glide blocks. Then drag and drop the tactile switch block inside the hexagonal space of the if arm. Now we need to continuously check whether the tactile switch is pressed or not. For that drag and drop the forever block around the if arm. Finally to trigger the script drag and drop the when flag clicked block above the entire script. Maximize the stage and click on the flag to run the script. Press tactile switch 1 on evive and watch toby jump. Observe that as soon as you click on the green flag, the rx0-tx0 LED starts blinking which shows that the communication is taking place properly. If it is not the case, stop the script, disconnect evive from the computer, then reconnect it and run the script again. As mentioned at the beginning of the video, you can interact with your hardware via bluetooth as well. This means you can now control toby or any other sprite via lsd. Right rid of the usb cable, open the magic lid of evive and connect the bluetooth module by placing it in the headers provided. Now if you remember to connect the board, we first clicked on the connect button and then selected the serial port to which our board was connected. Similarly for establishing a connection via bluetooth, click on the connect button and instead of selecting serial ports, select bluetooth ports. A list of nearby devices will appear, select your bluetooth module from the list. You can recognize it either from its name or from the address written at its back. With this evive is now interfaced with pictoblocks via bluetooth. Now maximize the stage, click on the green flag and make toby jump wirelessly. Not only can you interact with sprites but also control robots in real time. You must have noticed that while you were running the script, the menu wasn't visible on the screen. To access the menu, center press the navigation key. If you want to come back to the stage mode, select exit firmware from the menu. Now in all the above cases, a computer was necessary to control a hardware. But what if we want to upload a script to a board so that it can work independently? That is what we are going to cover in the next video. Till then, share this video with your friends and don't forget to give it a thumbs up. Also, subscribe to STEMpedia and follow us on Facebook, Instagram and Twitter for more such educational content. Bye Bye