Hello, friends.
Today I will tell you how to acquire and how to generate C datas using serial communication with the
help of visa in late.
For that purpose I just create the codes as you see over here in my previous videos, as you see over
here in this case I just writing two datas or to write this data over here, I just use a select button
and this select button will send a signal A or D if A is there according to that, it will turn on my
one and this is my two.
And if p signal goes from here, it will turn on led B on the hardware.
As you see over here, I have two elders for input and two LEDs for output.
So this will generate data for my Arduino and Arduino will generate data for these two LEDs.
As you see over here, this one, one green and this one yellow.
And these two LEDs are connected to the PIN number four and five, and the input are connected to eight
and nine digital pin.
Okay.
So just go to the Arduino code.
I will explain you.
So over here I just first configure or assign variable to one led to fifth and fourth.
These are my input pin.
These are my output.
Okay then LDR one.
LDR two.
These are my input pin.
These are from LDR.
Then I have variable.
We are for the output and VR1 and VR2 for input.
Okay.
Then you have to set the pin mode led one led to output LDR one ldr two as a input.
After this, go to the void loop.
I also share this code in my video.
So over here you have to just read serially read the data from the LabVIEW because LabVIEW will generate
a or B signal to turn on Led 1 or 2 or here, if it is equal to A it will turn on Led one.
If it is equal to B, it will turn on led to.
And these are controlled using two different switches.
After this.
Over here.
This is the code for the digital read.
So variable one.
It will read data from LDR one It will read data from LDR two and if variable one is high, it will
send the data to the indexing zero.
See else it will send D and if more character two is high, it will send the character to the indexing
one e otherwise it will send D and just print serial data in line form.
So over here and initially also over here, as you see, I characterize this character as the size of
this.
Or you can say the length of this is to 0 or 1.
Okay?
So you just need to run this code or upload this code into the Arduino board right now.
Arduino The code is uploaded properly.
Now just go to the LabVIEW code over here.
I just combined my two codes.
First one over here it is for Digitalwrite, for the LEDs.
And over here I got the read function from the elders.
Okay, so now you have to just set the comport over here.
So these two will generate signal for different two LEDs.
And over here I got the serial data as you see that is available using visa read over here.
And I just split these signals.
As you see from here, I got zero indexing.
When it is equal to C, it will turn on my Led and when it is equal to E, it will turn on led to that
is available over here.
So right now I just run it as you see right now data is read and I just split it.
So LDR one is off because it is not equal to C LDR two.
It is also because it is not equal to E, So I just place my hand or finger over the LDR so as you see
it will turn on because it is equal to E and when I just put my hand over the LDR one.
It takes some time because it also store the data as you see right now.
So this is how you can read the signals.
And now I just want to upload right data.
So first I turn on this.
As you see Led goes high off it, then turn on this led goes high.
The flickering is because of this time delay.
So this is how if you want to on both the LEDs, this is how you can control.
So this is the code for visa write and read process serially.
So this is all about today's lecture.
Thank you.