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)
{
}