NodeMCU ESP8266 // Video -3 //how to use virtual pin / LED brightness control using smartphone / PWM

 //CODE :-

#define BLYNK_PRINT Serial


/* Fill-in your Template ID (only if using Blynk.Cloud) */

#define BLYNK_TEMPLATE_ID "TMPLYN2sUxxS"

#define BLYNK_DEVICE_NAME "LED POWER"

#define BLYNK_AUTH_TOKEN "oOtfAPMIu06MiQWfa6ddLPdkTDDTRZGP"

#include <ESP8266WiFi.h>

#include <BlynkSimpleEsp8266_SSL.h>


// You should get Auth Token in the Blynk App.

// Go to the Project Settings (nut icon).

char auth[] = "oOtfAPMIu06MiQWfa6ddLPdkTDDTRZGP";


// Your WiFi credentials.

// Set password to "" for open networks.

char ssid[] = "AyubCreation";

char pass[] = "11221122";


int led = 13;

int pinValue;


BLYNK_WRITE(V1)


{


  int pinValue = param.asInt(); // assigning incoming value from pin V1 to a variable


  analogWrite(led,pinValue);


  Blynk.virtualWrite(V13, pinValue);


  Serial.print("V13 Slider value is: ");


  Serial.println(pinValue);


}

void setup()

{

  pinMode (led,OUTPUT);

 

  // Debug console

  Serial.begin(9600);


  Blynk.begin(auth, ssid, pass);

}


void loop()

{

  Blynk.run();

}











No comments