Hello, friends.
Today I will tell you how to generate signals using an eye tracker.
Basically, in this case I am just using a blink led code.
I just write blink Led code in the python.
And using this code we have to write these signals because in the case of Blink Led, we have both the
signals.
That is true and false.
In this case I just use loop and this is also an example of for loop.
So for that purpose I just import and I type max.
Then this is the library.
And after this, I just use time.
I just want to import time because I want to just place after how much time it will generate to and
how much time after how much time it will generate force.
So I just import
time library from Python.
The syntax is import time.
After this I just start the task or just assign a variable task in this.
Task.
It is an I.
I just call the library.
Then you have to just assign the pen and it's operation.
So it is task.
It is digital output pin because I want to generate digital signal.
Channels.
Add channel.
The Excel output
channel.
And inside this you have to just put the device name.
My device name is Dave one.
Then you have to just put port zero.
I'm using and the line zero, as you see on the hardware part over here, this is my port zero line
zero pin.
This is my ground.
I just connect port zero pin to the positive pin of led and ground pin to the negative of Led.
After this, you have to just start the task.
Does not start.
Well, then you have to assign an initial value.
And my value variable is value.
I just put true inside it.
Initially, the initial value is true, and I just also put a variable that is n for how much time or
how many signals my for loop generate in this case.
So I just put in this case only ten.
So my blink time, I just also put a variable blinking time.
Blink time.
You can use any variable name.
I'm just using blink time.
So it is let's say one.
It is in seconds.
Okay.
So in the place of one, let's say it is two seconds.
Okay, so now you have to just write loop.
So my syntax for for loop is for variable K in range.
Off.
And this is my loop.
An indentation or Here, you have to just write task.
And and say this just put the variable that is the value.
Then you have to just put how much time it will sleep for, how much time it will sleep.
So syntax is time to sleep.
And over here you just put that time variable that is blink.
Blink time.
After this, you have to just put the value
because I want to change the value after this particular time.
Negate this.
It is not value.
I'm using the syntax.
You can also put some first in the case.
Let's say you just write true.
After that, write false.
You can use this also.
I want to just check the value written by the code to the hardware part.
I want to check these value on the software part also so that that purpose I just use print command.
And inside this I just put value variable because this value variable will generate signals for my deck
card and for my software part also.
Then you have to just stop the task.
And close the task.
So this is the code.
The.
Save it.
Let's run it.
As you see right now, it is writing false.
True.
False.
True.
False.
Through.
Close to it will write only ten times because initially I assign these values.
If you want to write for multiple times, in that case, you just go to the code
over here, change the value.
Let's say you want to write only five times and blink time.
You want to change, let it is three seconds.
Just save it and run it.
Now, it will generate only five value in the previous case.
It will generate ten values.
You can check.
It will generate only five values.
If you want to work with this for a long time, you just put the time inside this and the values inside
this.
So as you see, it will generate false.
True.
False.
True.
False.
Only five signals.
This is how you can use blink program to generate or to blink Led or you can say how to use for loop
inside the python for hardware purpose.
So it is also an example of for loop.
This is all about today's lecture.
Thank you.