Read digital pin value

Hey Blynkers,
How to read digital pin information?

#define BLYNK_PRINT Serial
#include < ESP8266WiFi.h>
#include < BlynkSimpleEsp8266.h>
#include < SimpleTimer.h>

char auth[] = “***************************************”;

SimpleTimer timer;

int digitalPin = 5;

void sendUptime()
{
int pinvalue = digitalRead (digitalPin);
if (pinvalue==HIGH){
Serial.write(‘yes’);
}
else {
Serial.write(‘no’);
}
}

void setup()
{
Serial.begin(9600);
pinMode(digitalPin, INPUT);
Blynk.begin(auth, “Taram-Paparam”, “sdf4fsdfsf”);
timer.setInterval(1000L, sendUptime);
}

void loop()
{
Blynk.run();
timer.run();

}

On serial port always come ‘no’.
Where am I wrong?

Thank you very much!

Hello. If you don’t use widget with D5 you have to set pinMode manually for D5.

I want to create the sensor switch.
I am using esp8266 and sensor button.

When I touch switch, I want that esp8266 recive signal about it.
I wrote pinMode(5, INPUT); and read data by digitalRead (5); , but ‘pinvalue’ is always empty.

int pinvalue = digitalRead (5);

if (pinvalue==HIGH){
Serial.write(‘yes’);
} else {
Serial.write(‘no’);
}

What I am doing wrong? How to read data from digital pin esp8266? I didn’t find any information and documentation.
Help please if someone faced with that problem…

You need " instead of ’ around the yes

Maybe?

A post was split to a new topic: Correct use of BLYNK_WRITE