Hello friends.
Today I will tell you how to read Digital signal using Visa.
In this case I'm using Arduino hardware and one LDR sensor.
It will detect light and according to light it will generate signal.
As you see, when I put my hand over this LDR over here, board module Led goes low, so this is how
it will generate signal.
So right now in this module we have VCC ground and one output pin.
So VCC ground are connected to VCC, connected to the five volt ground is connected to the ground on
board Arduino and this pin output pin is connected to the digital PIN number eight.
So now go to the software part over here.
I have the Arduino code as you see in this, I just use a variable LDR one.
I just connect it or assign a digital pin eight then int variable variable name is one, then void setup
Serial.begin baud rate 9.600 Pinmode.
In this case the pin is LDR one and the pin mode is input then void loop.
Then over here I just go to the variable.
It will still read.
And read from one.
If variable one is high when it is high, it will print serial write a.
Else it right be okay.
So this is the code for Arduino.
Now just burn this code into the Arduino, select your Arduino board, then select your port.
My com port eight is there now just run it.
Directly click on upload.
Uploading is done.
So now I just close this.
I just go to the LabVIEW code Over here in this lab code, there is some change from my previous lecture.
As you see over here, I have Visa configure serial port.
You can find this one in serial configure port over here.
This is the serial configure port.
Then you just need to convert bytes to port bytes at port.
So again, you just go to the serial over here bytes at serial port.
It will read bytes at serial port.
So you need to just drag and drop this.
Just make its label visible.
It is my property node.
Then over here, this is my visa.
You just need to connect.
Source to source error into error out and over here byte port to the visa read.
In this case I'm just using visa read function.
I just label it.
I just make it large for you so that it is readable.
Control you.
So as you see over here.
So it will read my bytes available at the given port.
Over here.
I'm just using delay of 10s.
If you are not using this, I just show you.
What happened.
So over here, this function is my string length subset.
String.
So over here, I got the different values.
A series of values.
And I want just only one value.
When this value is equal to a, it will turn on my l d r.
Okay, then close.
Okay, so this is my function.
So now I just hit on run button.
Let's see what happened.
So before it you just need to set your port also.
Or here in the visa resource name.
The port is on port eight.
I hit on run button.
As you see, our hair comes directly When I just put my hand a finger over LDR, it will generate a
Led goes high.
So this is how it will read serial signals.
Okay, Using Visa.
Now, just stop it.
In this case, when I just remove this one, let's check what happened.
I again hit on run button.
Signal is changing, but it is not showing.
It is very fast.
Okay.
So it is not visible for bear eyes to check what happened.
But in between LDR goes high for some seconds.
So in this case I just again bring my delay.
It is ten milliseconds.
Okay.
And if you want to also check what is the output of this substring, I just create control over here,
not control indicator over here.
It will generate signal for me.
Over here I get a series of data like Bvb.
And over here I just only one data because my length is one string.
Subset length is one.
So when I hit on run button.
As you see over here.
I got B when I just put my hand, I got a and my head goes high.
So this is how you can read digital signals using visa with the help of or you can interface any signal
or any sensor with your Arduino or any hardware device and you configure your LabVIEW using Visa to
read this serial signal.
So this is all about today's lecture.
Thank you.