What is the communication port and you are familiar with the basic terminology behind this concept? There is only a minor difference here that in the previous lecture, we used the serial library for our communication with arduino. But this time we are using the pi filmata library that we imported earlier. The reason we are doing this is that it is easier for us to pass input to digital pins, using wi, fi, mata library as compared to the serial library so thats why we are using this library instead of serial communication. So i will go to the top and the first thing i will do is i will store my current communication port in a new variable. So i will go here and here i call the board variable and image i will say: pytha dot, arduino and in it i will pass the current communication port. So for finding the communication code, i must connect my arduino ide with my laptop, so allow me to connect it to my computer now, since our arduino is connected to our computer, we can find the active port number by going to our device manager and now here In the device manager under ports, we can see that our active port number is comet. But if you do not see something like this, then there might be an issue of the missing driver. So, in order to resolve that issue, you can go back to the previous lecture where we discussed the solution of this error in detail.

So after solving this error, i will go back to my vs code. I will write commit as my active port number and now we can move forward to our arduino code. So now for turning on the light, i will say elsif turn on the light is in the query and next i wanted to say, speak turning on the light. So that the user can know that it is now following this specific condition, and now in the next line, i want to target a pin of arduino, as we want to assign a value to that specific pin. So, for targeting a pin, we will call the board variable that we created earlier and with board variable. I will call another function, digital which will allow us to target a specific pin. So in brackets i will call the specific pin that i want target, which in our case is pin number three and with that pin i will call another prebuilt function from pyfarmata library, which is right. This function will allow us to assign a value to this pin, as we discussed in the previous lecture, that a pin can have two different values: either it can be high or low, but in our case it must be low for turning on the light. So i will say right and in it i will pass on 0, which is equivalent to low. Now, after speaking and before turning on the light, i want it to wait for some time so for this i will go here below the speak function, and here i will call time dot sleep and in it i will pause sometime like 0.

1. Our own command is all set. Now we can move forward to our off command so now for our off function. I will say, as if turn of the light is in the query now for this first, i will call the speak function and i will pass on turning of the light for alerting the user that now it is in the off condition. Now same as above, i will call the sleep function from time, library and i will pass in 0.1 and next to it i will call boar dot, digital and in digital function. I will pass the pin number three, as we are targeting the same pin as we did in the previous condition, and i will say, dot write and this time the value will be 1, as 1 stands for high, so for turning on the the light, our value Was low but for turning off the light our value is high. Our function is all set.