Use blynk button as an interrupt to the sensors

my project consist of ldr and led connected to arduino uno and wifi shield that will turn on the led when there is low light. but it is possible to make the blynk button to force the led to be turned on even when light intensity is high. this is my very first project.
thank you in advance.

Short answer… yes.

Long answer… well, you will probably need to write code that takes your auto/manual mode button state into consideration and adjust the light intensity calculation or full intensity based on flags and boolean logic and so on :stuck_out_tongue:

OK, in reality, search this forum for others that have asked similar auto/manual questions… basically, beyond some basic direct pin controls from the App (which can do some amazing things from that alone), you do need to learns some “arduino” coding to let the real fansnazzy stuff happen.

So if you know enough basic coding then great, work on implementing it into what you already have (you do have something already… right? Show use it here)… if not then you need to learn, perhaps from 3rd party teaching sites or all on your own via trial and error, like I do.

We do not teach programming here, nor build it for you… But once you get started, we will help guide you to the correct documentation, give out pointers and suggestions and many members have even written and posted their own projects or examples that you can start from.

i just thought of using a relay module then use that as an on off switch rather than creating a complex coding. is that also possible?

Sure… almost anything is possible.

#define BLYNK_PRINT Serial


#include <ESP8266_Lib.h>
#include <BlynkSimpleShieldEsp8266.h>

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

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "Nak";
char pass[] = "1234567890";

// Hardware Serial on Mega, Leonardo, Micro...
//#define EspSerial Serial1

// or Software Serial on Uno, Nano...
#include <SoftwareSerial.h>
SoftwareSerial EspSerial(2, 3); // RX, TX

// Your ESP8266 baud rate:
#define ESP8266_BAUD 9600

ESP8266 wifi(&EspSerial);
const int relay_pin = 12;
const int ldr_pin = 2;
const int lamp = 13;
void setup(){ 
  pinMode(ldr_pin,INPUT);
  pinMode(relay_pin,OUTPUT);
  pinMode(lamp,OUTPUT);  
  Serial.begin(9600);
   EspSerial.begin(ESP8266_BAUD);
  delay(10);
  Blynk.begin(auth, wifi, ssid, pass);}
void loop(){
   Blynk.run();
  int value_ldr = digitalRead(ldr_pin);
  Serial.println(value_ldr);
    if(value_ldr==HIGH){
    digitalWrite(relay_pin,HIGH);
    digitalWrite(lamp,HIGH);
    delay(10);
  
    }
      else {
    digitalWrite(relay_pin,LOW);
    digitalWrite(lamp,LOW);
   
  }
  
}

i have try this code is working fine without the blynk code inside. but when i include the blynk code the program seems to b not working. even the arduino board is not connected to the internet. i have follow from the example on code to connect to internet

I fixed your posted code as per the requirements shown in the Welcome Topic

Keep all this out of the void loop() and into its own timed function…

http://help.blynk.cc/getting-started-library-auth-token-code-examples/blynk-basics/keep-your-void-loop-clean

Learn about BlynkTimer…

http://help.blynk.cc/getting-started-library-auth-token-code-examples/blynk-basics/how-to-display-any-sensor-data-in-blynk-app