Hello friends.
Today I will tell you how to interface a LDR module or LDR sensor using Mario.
In this case I just use LDR to generate signal for Mario.
I just acquire this signal using two methods.
One is using analog signal, one is using digital signal.
So let's go for this.
So first case I just use Express VI.
So over here, this is my radio.
I just use analog input over here.
I'm just using the Express VI.
Or here on this module we have three pins.
One is VCC.
I just connect it to five volt.
One is ground.
I just connect it to ground and one is my input.
I just connect it to analog input.
Okay.
So I just place analog input over here.
Let's check what happened when the signal is there.
So right now you have to select the pin.
I just connect this to a zero analog input.
Zero pin pin number three.
I'll just connect it over here.
Now you just create a indicator over here.
I just use this meter.
Connect this meter.
Create a while loop over here for continuous reading.
Create controls.
Save the code.
Run the code.
It will deploy, as you see right now.
The value is nearby zero.
When I just put my hand over it, it is generating around five volt.
Okay.
So right now it is generating around five volt signal.
So if you want to check the value, also just create its digital display over here.
As you see, I just make it large for you so that it is visible.
So again, save it, run it.
Right now it is when light is there, it is generating 0.395V.
And when I just put my hand over it, it will generate 4.85 around Volt.
Okay, so this is how you can interface using LDR with the help of analog input.
Now I just use digital pin in place of this, so I just close this, go to my radio.
I need to remove this one.
Also go to my toolbox.
Digital input I have to select.
In this case, when I just use digital signal, you have to just change the pin.
Also, as you see right now, I'm just using analog pin that is zero is at 11.
I want to just use 31 pin, let's say analog digital input output pin ten that is available at 31.
Okay.
So I just select Port A.
Okay, PIN number 31 is there.
So I just remove this red wire from here and connect this wire to 31 number pin over here.
This is my 31 number pin available.
I need to just put one over here Boolean, which will show me the signal.
I just connect this save It controls.
This is a case using express.
Now you need to deploy the code inside this when the code is deployed.
When I just put my hand as you see it will turn on the boolean led if you want to.
So the output on hardware also, let's say I'm just using.
Lead Express VI also led button I'm just using over here.
I just need to drag it over here.
In this case, let's say I want to.
Put the output of this LDA on zero.
So you need to select that particular place.
Okay.
Just connect this particular led with your Mario output or a digital output.
So over here I just connect it, control you.
It will minimize.
So it will show me on this button also in the software, also in the hardware also.
So let's say I want to just save it.
Now deploy the code.
As you see right now.
Onboard LEDs off, as you see on software.
It is also when I just put my hand over it, software goes high and LEDs zero also high.
So this is how you can use your hardware to generate software and hardware
results.
So now in this case I am just using Express VI.
So in my earlier video I just used low level programming for analog.
Now I just go for the digital signals for analog, low level programming.
So I just select over here digital input output over here.
So first you need to open, then you need to read the signal, then you need to close.
So over here, you need to connect all these functions.
Create control over here.
I need to select PIN number ten Digital input Output pin number ten.
That is available on.
It is not digital input output pin I need to check.
So I just go to the over here.
So this is the input output.
PIN number ten is at 31 pin.
I just connect this pin already.
So pin number ten, I have to select over here.
Control T now I just need to create a while loop over here.
Create control over here to stop this.
Just show the values I need a Led right now.
I just use the square led in place of this connect.
This led.
As you see right now, it is a different type of data.
I just connect over here.
I need to go to index array function, connect this one over here, create a constant over here and
connect this one to this particular control u to minimize the code.
Save it.
Run it.
Deploy it.
This is how you can go with low level programming.
In the case of when I just put my hand, it will turn on off, on off.
This is how you can create, generate signals or acquire signals.
Right now I am just acquiring the signal.
Let's say I want to generate the signal on the hardware.
Also in the previous case also as we discussed.
So over here I just go to again my low level programming.
I just need to write the signal in this case, just select this over here.
Same.
I just need to copy this.
Over here.
I just need to write.
I just copy this clause.
Also connect this one.
Replace these values with shift registers so that some error is not there.
Chef starts.
Now you need to set the channel over here.
Let's say I want to go with a Led on board led to, let's say in this case.
So over here it will generate the signal for me.
Control B again, you need to set build an array over here.
Connect this particular led.
Give this signal to over here.
Control u to minimize.
Save it.
Right now the signal is displayed on Led.
To run it.
Deploy it.
So now as you see, the code is deployed.
It is taking time.
As you see, when I just put my hand to goes high.
It is visible to you on board.
Led goes high and on the software also.
So this is how you can go for digital signal acquisition or LDR.