LDR not working properly with Blynk

Hello guys!
I am facing a problem with using the kickstarter app Blynk.
The thing is, I want to create an alarm with a LDR and piezo. When there is light present, the piezo will start buzzing.
But,a new twist to my project. That is that I want to be able to turn on and off the LDR with the app Blynk.
The problem occurs here,with the code I used, turning off the LDR will work,but turning it on renders the LDR useless as it doesn't turn off my piezo.
Here is my code

#include <SoftwareSerial.h>
SoftwareSerial SwSerial(2, 3); // RX, TX
#define BLYNK_PRINT SwSerial
#include <BlynkSimpleSerial.h>

int lol;
int analogVal;
int ldrval = A0;
int piezo = 7;

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

void setup()
{
  SwSerial.begin(9600);
  Blynk.begin(auth);
  // Default baud rate is 9600. You could specify it like this:
  //Blynk.begin(auth, 57600);
}

void loop()
{ 
  Blynk.run();
  
  analogVal = analogRead(A0);
  if(analogVal>600) tone (7,262,250); delay (250);
  
  if(analogVal<600) noTone (7);

}

BLYNK_WRITE(A0)
{
}

There is nothing in that code that will turn on or off the LDR.
Read how to use this forum sticky post, it tells you how to ask questions and what information you should supply.

Don't assume anyone knows about an obscure kick starter. Supply links to libraries that are none standard ones.

Hi,

That is that I want to be able to turn on and off the LDR

Do you mean you want to disable the effect of the LDR?
How do you want to do that?
1)
Using another input?
So leaving the relay SET or RESET what ever its state when disabled.

Or
2)

Disable the LDR inut when the Relay is activated, thus SETTING it ON.
How will you Reactivate the LDR and hence RESET the relay?

Tom... :slight_smile:
Also a link to the Blynk App.