This way we just see how to read digital signal using ESp8266.
So for that purpose we just go to Developer Zone create new template.
In this I just name it Digital read.
So I am using ESP 8266 connection type.
Wi-Fi.
Just click on done.
Now you just create a data stream for this new data stream.
My data stream should be virtual pin.
So just I'm over here.
I'm using the zero pin.
So just name it.
Let's say d one or D zero.
D0D8.
So right now d zero is there.
I just connect d zero with plus five volt or plus three volt and ground volt and ground.
So that I just acquire when it is connected with three volt we just get I mean we just connect it with
ground.
We just acquire zero or low signal.
Okay.
So now I just go to the web dashboard over here.
I just drag the input state or LED.
So I just drag this LED over here.
You just increase the size.
So right now this is the LED.
Just click over here.
You just select the data stream.
The color may be red.
You just select save it.
Now you just check the output of the V0 pin over this d0 led.
Okay.
Now just go to device before this.
You just need to save it.
Also right now as you see I forgot to save it.
So again I need to create new data stream virtual pin.
So this is my D zero.
308.
Now web dashboard go to the LEDs.
Let's drag over here.
is the size.
We just change the color.
Also, I am just putting red over here.
Save it.
Save it from here.
Now it is saved.
So go to the device.
Create new device from template.
You just select the template name.
Create.
Right now this is my authentication ID.
Template ID and template name.
So just copy this.
Go to the code over here.
You just paste it.
So this is the same.
My wifi ID password is same.
So over here there is a little bit difference in the code.
Void setup Serial.begin.
It is the baud rate.
Blink dot begin.
You have to call pin mode.
I'm using pin number 16.
That is d0 pin European.
According to the diagram, then in the void loop you just blink, run it, then we have a variable signal
state.
We just use digital read from pin number 16 and we just write it over the blink virtual write v0.
Okay.
So we just use v0 and over v0.
We just put the signal state and at a one millisecond delay okay.
So you just need to write this code for me.
Selected ports board is selected.
Just run it.
So it will take some time.
So now code is compiling.
So now it is writing in the ESP controller.
70% 30% 38%.
Hardly.
Take one minute and writing the code.
So now.
Code is successfully burned in the ESP 266.
Now we require signal.
So we just go to the hardware part.
Part.
As you see right now I just connect D zero pin.
So this is my D D0 pin over here.
This is my d0.
Now I just connect.
Three volt signal to my D0 pin.
Okay so right now I already just reset it.
So let's check what happened on the dashboard.
Go to the device.
Go to the device over here.
Device is online.
Digital read.
As you see color is red.
Let's check what happened when I just connect.
In place of three volt.
So I just remove this and connect Ground signal over here.
So what happened now?
Signal is off.
So when I just connect this three volt signal over here, my signal is high after some delay.
As you see, signal is red.
So now we just see the signal over the mobile phone also.
So as you see over here this is my digital read.
You just configure it add a signal right now.
Add EV require a LED.
So go to the LED.
So this is my LED over here.
You just need to select the data stream.
My data stream is D0.
Back.
So right now let's check.
Right now it is connected with three volt.
So it is its color is blue.
Let's check what happened when I just connect the ground over here.
As you see it is off.
It is in off condition.
It is up to you how you show the off condition, how you show the on condition.
Let's change the color of LED.
So I just go to the device on the dashboard.
I just added this.
I want to change the color to let's say orange okay.
So let's check what happened.
Save.
Again go to the device Digital read.
So right now it is in off condition when I just connect it with three volt.
So now it is glowing or it is in high state.
So this is how you can read digital signal using ESP 82366.
You can connect any sensor that generate digital signal using this code.
Also like if you want to interface IR sensor, if you want to interface LDR.
If you want to interface Pir sensor, you just use this code only.
So using this code you can read any digital signal using ESP 8266.
Thank you.