Code For Led brightness controll using Slider

 Code for Led brightness controll using Slider of Blynk app with NodeMCU esp8266


#define BLYNK_PRINT Serial


#include <ESP8266WiFi.h>

#include <BlynkSimpleEsp8266.h>


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

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

char auth[] = "cdvbhkl7swRm-cJy5Tu_F2J17j-pIuKr";


// Your WiFi credentials.

// Set password to "" for open networks.

char ssid[] = "Name";

char pass[] = "Password";


BLYNK_WRITE(V0)

{

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

  // You can also use:

  // String i = param.asStr();

  // double d = param.asDouble();

  analogWrite(D1,pinValue);

  Blynk.virtualWrite(V1, pinValue);

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

  Serial.println(pinValue);

}


void setup()

{

  // Debug console

  Serial.begin(9600);


  Blynk.begin(auth, ssid, pass);

  // You can also specify server:

  //Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 80);

  //Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8080);

}


void loop()

{

  Blynk.run();

}

Comments

Popular posts from this blog

Code for IR sensor

Code for HC-05 Bluetooth Module