BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

Read a digital pin, using LCD widget


#1

//Proyect for NodeMCU
//How read digital pin, using widget LCD
// To correct the library's syntax
` #define BLYNK_PRINT Serial    `  
`  #include <ESP8266WiFi.h>      `
` #include <BlynkSimpleEsp8266.h>  `
` #include <SPI.h>    `

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
char ssid[] = "xxxxxxxx";
char pass[] = "xxxxxxxxxxxxxx";

int D1 = 5;  // gpio 5-------D1 
int D2 = 4;  // gpio 4-------D2

BLYNK_READ(V0) {
  pinMode(D1,OUTPUT);
  pinMode(D2,OUTPUT);
   Blynk.virtualWrite(V0,digitalRead(D1)); 
  
}

BLYNK_READ(V1) {
  Blynk.virtualWrite(V1,digitalRead(D2));
}

void setup()
{
  // Debug console
  Serial.begin(9600);

 Blynk.begin(auth, ssid, pass);
}

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


#2

Did you have a question?

In the future, please format your code as recommended (I have already edited your first post so you can see how it is done)…