Hello, friends.
Welcome to Python and live view.
Integration course.
Basically in this course.
We will create a python code.
And using that python code, we will get the results in lab.
Or you can say.
We will call.
Python coding lab.
So for that purpose, first you have to download lab, you and your system.
So over here you have to type, download or you can say.
Have you.
Download Apps for your download and on the first link.
You get the information?
For the lab view integration with Python.
They require by time 3.9.
In case of if you have lab view 2021, if you have lab view 2022 because right now 2022 is available.
You can use any type of war zone that is available one by one.
So first, let's say you are using 2022 to.
From here you can download it and over here you will get 6.4, six and B file and click on that.
After clicking on that file, you have to select which toolbox you want to use in view.
And over here there are different versions like this full professional community or runtime right now
or here 32 bit is also there.
So if you want to download this.
Again, the same procedure is there.
And if you want to install it.
Offline.
In that case, 48.76 GB software is there.
You can just click on this and extract it.
After this.
Like a video game or a game software.
You have to click next, next, next before selecting your particular toolbox.
So this is how you can download view in my system I already have lab view 2021.
As you see over here, this is my 2021 version and it is 32 bit.
Okay, so I just minimize it.
When you download life, you.
After that, you have to search for Python.
Download Python.
Okay.
So over here.
When you go to Python download or here the latest version is 3.10.6.
It will work with 2022 live version.
But in my case, that is 2021.
So the last test was done which will work with Lebanon 2021 it is 3.9.
So I have in my PC 3.9.
Ideally 3.9 32 bit.
So I just go for.
Let Python.
3.9 download.
Okay, so over here when I just click on this.
Here are executable files.
So I just go with window x 86.
Basically it is 32 bit.
If there is 64, in that case there is 6064 bit installer also there.
I just go with this.
I already have python also after downloading Python.
You just go to VI?
PM basically when you download and install lab view, in that case you will get via PM.
Basically, this is a.
We are a package manager.
So over here in the search menu, you just search for Python and over here there are different toolbox.
Basically, these are part of our toolbox.
I just install this one.
If you want to install accommodation, you just go over here.
I have standard edition.
So in that case there is an installation option, is there?
So it is installed by turn integration toolkit is already installed in my system.
So these are the three requirements for Python integration with live view.
So I just close this.
Okay.
So now I just go to my lab part.
I disclose this also.
So now I already create a folder in documents.
I got here by ten and leave you integration as you see.
And in this I already create a addition.
VI.
So let's check how we can create an education program in.
Lab.
You add wells as well as in Python.
So over here.
So first I open.
By ten, ideally 3.9.
And I just open the already created file.
So I just go to document.
Python integration with lab code.
So this is my code as you see or hear my result.
Initial result is zero.
I just define a function addition.
X comma y.
In mutation.
Result is equal to X plus y.
And I also want to print it.
Brent.
President.
Okay.
Great result.
And over here, I want to.
Brent.
The addition of two and five, so I just run it.
If you ask me to save the code.
So when I save, I got the result.
Two plus five is by two seven.
If you want to go with different result, let's say four plus five.
Again, I want to run it.
Ask me to save as I got mine.
So this is the python code.
Now I want to call this code in live view.
So for that purpose, I do not require this print.
And I also did not require this.
So my program for life is result is value zero.
Initial value is zero defined.
Define a function addition x comma y result x plus y return result.
Okay, so I just make it over here.
Okay.
So I just save it.
Controllers, just close this over here.
There is my hydration dot.
By now I create.
Calling via.
So I just open my lab view and over here there is my.
So this will.
Comes for the components comes from over here, as you see.
So I just use strip pop.
This is my strip path.
The function of strip part is return, the name of the last component of a path and the strip path that
leads to that component.
Basically, this current VI path goes here and it will create a path for my.
Via.
Or it will create a path.
Python or path.
So over here.
This is my build path, step path, great path as you see and in the file constant, you will get the
this current view path.
So over here this is my current path.
Now I just create a constant for this build path and I just name it the function name of my python code.
As you see, my code is addition by I just put addition by.
And when I control E, when I hit on run button it will create the path.
So C users so know this is my name.
So command python and integration.
Python integration py code and addition.
It will create the location of the this code.
And over here I just create patterns.
From here I just use single.
And in this, I just edit my icon.
Right now my code is for addition, so I just put add.
So I just close this.
Save it.
Okay, so this is my sub vi over here.
This is my sub by tradition.
Now, I just go to my main vi that is in lab view.
So over here in this.
So I just
put it over here.
So these functions are from that third party manager that is from VIP.
So you have to just go to connectivity.
And this this is my Python integration toolkit.
So over here, first you have to open Python session.
This one is my open python session.
I just make the label visible, as you see over here.
This is my open python session, and this is my python node.
As you see over here, visible item, python code.
And this is my python.
Close the session.
And I also use over here a simple error handler.
So just connected.
Visible its name.
Simple error.
And over here I just create a y loop for continuously reading.
And this is my function name.
This is my function name.
That is a region that is defined in python code.
And over here there is my sub v the error sub v as you see over here, this is my sub vi.
I just close this.
It will go over here.
Connect the in session now to session in error.
How to error in and over here I just put zero value and in this case I have two variables x and Y.
So that's why I just connected.
There is no addition code right now in lab view.
If I want to create a validation code for this, I want to create this code.
This code, this python code is similar to this block as you just create a control.
Create a control over here.
And this is my indicator and I just put a Y loop over here and create in the node indicator, create
a control.
So this code and this code are similar.
This code is in Python.
And in this code I will call Python code and leave this code in lab view.
So I just delete this and let's check the output of python code over here.
My version is 3.9 because I already told you that 20, 20, 21 version will work with 3.9 Python version
for 20 2022.
You can use 3.10 or later on versions.
Okay, so I just go to the front panel window and I just put over here four and over here for I just
run it.
Let's check what is the value?
As you see over here, I go to the eight in the real time.
I will check the value.
As you see, I goes on increasing, the value goes on increasing and the code is written in Python.
So this is how you can create additional code in lab view.
Or you can say you can call python code in the Python edition code in live view.
Thank you.