Posts

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"...

Code for HC-05 Bluetooth Module

Code for HC-05 Bluetooth module with NODEMCU to controll LED void setup() {  pinMode(D0, OUTPUT); Serial.begin(9600);     } void loop() { if (Serial.available()){   char data;   data=Serial.read();   Serial.println(data);   if (data =='o'){     digitalWrite(D0,HIGH);     delay(1000);    }   else if(data =='c'){     digitalWrite(D0,LOW);     delay(1000);   } }    }

LED controll using Blynk App

Code for LED ON/OFF Using blynk app with NODEMCU #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[] = "36F6Titc54BVme6b1ffrDCU0bAauTvMg"; // Your WiFi credentials. // Set password to "" for open networks. char ssid[] = "Name"; char pass[] = "Password"; void setup() {   pinMode(D1,OUTPUT);   Serial.begin(9600);   Blynk.begin(auth, ssid, pass); }    BLYNK_WRITE(1)   {     int led = param.asInt();     if(led==1)     digitalWrite(D1,HIGH);     else     digitalWrite(D1,LOW);   } void loop() {   Blynk.run(); }

Code for IR sensor

Code for Counter using IR sensor with NODEMCU int irPin=2; int count=0; boolean state = true; void setup() { Serial.begin(9600); pinMode(irPin, INPUT); } void loop() {      if (!digitalRead(irPin) && state){       count++;       state = false;       Serial.print("Count: ");       Serial.println(count);       delay(100);   }   if (digitalRead(irPin)){      state = true;       delay(100);   } } Code for Object detection using IR sensor with NODEMCU int value; // variable to store value read on digital pin  void setup()  {  pinMode(2, INPUT); // initialize digital pin 2 as an input  pinMode(4, OUTPUT); //for LED as output } void loop()  {  value = digitalRead(2); // read value on pin 2  if(value==1) // if value is 1  {  digitalWrite(4, HIGH);...