hi guys, I have a problem with the code. I would like a notification to arrive when the brightness sensor value goes down. at the oxen it’s about 1000, when it’s light it goes down under 800. I would like it when I got down I got a notification in my cell phone. Can you help me? thank you
the code is:
#define BLYNK_PRINT Serial
#include <SPI.h>
#include <Ethernet.h>
#include <BlynkSimpleEthernet.h>
char auth[] = "xxx";
int analogInPin = A0;
int sensorValue = 0;
void notifyOnButtonPress()
{
// Invert state, since button is "Active LOW"
int isButtonPressed = !analogRead(0);
int photocellReading;
if (photocellReading < 800) {
Serial.println("Button is pressed.");
// Note:
// We allow 1 notification per 5 seconds for now.
Blynk.notify("Yaaay... button is pressed!");
// You can also use {DEVICE_NAME} placeholder for device name,
// that will be replaced by your device name on the server side.
//Blynk.notify("Yaaay... {DEVICE_NAME} button is pressed!");
}
}
void setup()
{
Serial.begin(9600);
Blynk.begin(auth);
pinMode( analogInPin, INPUT);
// Setup notification button on pin 2
pinMode(0, INPUT_PULLUP);
// Attach pin 2 interrupt to our handler
attachInterrupt(digitalPinToInterrupt(0), notifyOnButtonPress, CHANGE);
}
void loop()
{
sensorValue = analogRead(analogInPin);
Serial.print("sensor = " );
Serial.println(sensorValue);
delay(1000);
Blynk.run();
}