Hello, friends.
Today I will tell you how to interface three different sensors.
Or you can say four different sensors.
One is my touch sensor, one is my LDR, one is my.
Air sensor.
And also one is my button.
So in this case, in this particular case, I just use my Rio code over here.
This is my my Rio project I just select first.
I'm just using different express services.
So let's say I want to first select digital input for my air sensor.
This air sensor is connected to my Port B In this module we have three pins.
One is VCC, one is ground and one is signal.
So I just connect this with my digital PIN number ten or it is pin number 31 on Port B, I just configure
it.
My LDR is connected to port a pin number 31 again, and my air sensor it is connected to PIN number
zero, of course, digital pin.
So I just again go to the my Rio.
I just locate over here so that I just again select.
Right now, I just show you a different type of code in this case.
So over here I just select PIN number ten.
Now I just need another digital pin for Port C, That is my touch sensor over here I just select.
You can also go with low level coding.
I already explained this in my previous videos.
So over here, this is my digital pin number zero.
Now all the pins are configured.
I also select the button also over here.
So now button is also configured.
That is onboard button.
It is available on Mario itself.
So now I just go to the system over here.
I want to select the button Boolean.
Uh, in the classic.
I just go over here, I just select this round led.
I just make a copy of it.
Four times I needed in this case because I have four signals.
Just make it aligned properly.
First one is, let's say my sensor.
Second one is, let's say my sensor.
Third one is my, let's say, touch sensor.
And fourth one is my button.
Okay, so now you need to connect all these one.
So this is B, it is connected to R, This is a this is connected to my port A and this is connected
to Port C and this button is connected to my hardware onboard button.
Now I just go to Boolean over here.
I need to use different gates, let's say.
So first, in this case, I'm just using end gate if the output of i r.
And LDR.
Comes in this case, it will turn on the Led.
I just go to the again, my radio toolbox over here.
I just need to select the Led Express VI.
So over here I just select all the four LEDs.
When Elder One and I are both are turned on or both will get a signal, it will turn on my zero.
Okay.
If the condition is that if the LDR or.
The touch sensor will generate signal.
In that case, it will turn on the Led one.
If.
That sensor.
Or button anyone gets output.
In that case it will turn on led to.
And last signal, if you, let's say, want to compound when all the buttons not all the only three.
I'm just going for three, let's say your sensor.
Touch sensor.
And it will turn on my Led three based on this.
So minimize it.
Create a loop over here.
Create a control over here to stop the button.
Save the code.
Run the code.
Deploy the code and let's check what happened.
So in the usually I just check for every sensor like air touch and the button also.
So as you see, it will turn on my air sensor.
So when I just put my hand over here it is.
Differently configured.
You just need to change.
I just place a node gate over here because it is generating signal initially, so I just delete this.
I just make note of this.
So in this software part, it will run properly right now.
Control s.
Or you just need to change on hardware.
Also right now, code we just deploy the code.
As you see when I just put my hand over.
It will turn on to LEDs because I just use exclusive or and or gate and it also turn on my HDR signal
or the software when I just put my touch sensor.
In this case, again, exclusive or or it will turn on.
Now I just go to the LDR.
When I just put my hand over here, it will turn on the and when I just put my hand on the or the LDR
and it will turn on zero Led one.
Now I just turn on the button.
It will turn on to and button also.
So this is how you can program or how you can create hardware and software in loop coding.
So this is all about today's lecture.
I just stop this code over here.
Thank you.