Kaustubh Agarwal
Published © LGPL

How to use Virtual Pins in Blynk

A tutorial on how to use the most important element of blynk.

IntermediateProtip1 hour16,982
How to use Virtual Pins in Blynk

Things used in this project

Hardware components

ESP8266 ESP-01
Espressif ESP8266 ESP-01
×1

Software apps and online services

Blynk
Blynk

Story

Read more

Code

Ldr alarm

Arduino
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "8d82695b6d7cxxxxxxxxx";
int rcvpin=A0;
void setup()
{
  Serial.begin(9600);
  Blynk.begin(auth, "TP-LINK", "yyy");
   pinMode(rcvpin,INPUT);
}
  
void loop() {  
   int ldrval=analogRead(rcvpin);
if(ldrval<100)

{
Blynk.virtualWrite(5, HIGH);
}
else {
     
      Blynk.virtualWrite(5, LOW);
      }
    
    Blynk.run();
     }
   

Credits

Kaustubh Agarwal

Kaustubh Agarwal

14 projects • 193 followers
IoT Enthusiast SDE@ASML

Comments