@Lichtsignaal I had a library issue. I fixed it and then it complied, but its not sending me email as the timer assigned, It only send it once. And I am still getting X=0. I am not sure how to connect the code so X will be managed from the slider.
Can you show us what you got so far, as to the code? Yo must also remember you cannot send more than a couple messages (or even one I think) per minute. This is due to prevent server overload.
@Lichtsignaal I have been working on it since then. Sorry for not updating you, but I got the code working with the slider. This is my full code:
/* Comment this out to disable prints and save space */
//#define BLYNK_PRINT Serial
/* Set this to a bigger number, to enable sending longer messages */
#define BLYNK_MAX_SENDBYTES 128
#include <BlynkSimpleStream.h>
#include <SimpleTimer.h>
int redPin = A2;
int bluePin = A3;
int sensorPin = A10;
unsigned int notified = 0;
int X;
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "******";
BlynkTimer timer;
void setup()
{
Serial1.begin(9600);
Serial.begin(9600);
Blynk.begin(Serial, auth);
pinMode(redPin, OUTPUT);
pinMode(bluePin, OUTPUT);
Blynk.email("****", "Watch!", "Tempreture Warning!");
timer.setInterval(5000L,slider);
}
void slider()
{
Blynk.virtualWrite(V1,X);
}
BLYNK_WRITE(V1) // Slider function to get X Value for use in another function.
{
int reading = analogRead(sensorPin);
float voltage = reading * 5.0;
voltage /= 1024.0;
float temperatureC = (voltage - 0.5) * 100 ;
float temperatureF = (temperatureC * 9.0 / 5.0) + 32.0;
X = param.asInt();
int maxTemp=X+5;
int minTemp=X-5;
if(temperatureF >maxTemp ){
int emailTemp=temperatureF-5;
Blynk.email("********", "Warning! High Temp for Baby, Temperature is:",emailTemp );
// timer.setInterval(10000L,setup);
setColor(255, 0, 0);
digitalWrite(redPin, HIGH);
}
if (temperatureF < minTemp ){
int emailTemp=(temperatureF-5);
Blynk.email("******", "Warning! Low Temp for Baby, Tempreture is", emailTemp);
// timer.setInterval(10000L,setup);
setColor(255, 0, 0);
digitalWrite(redPin, HIGH);
}
else{
setColor(0, 0, 255); // blue
digitalWrite(bluePin, HIGH);
// timer.setInterval(10000L,setup);
}
timer.setInterval(10000L,slider);
}
void loop()
{
Blynk.run();
timer.run();
}
void setColor(int red,int green, int blue)
{
#ifdef COMMON_ANODE
red = 255 - red;
blue = 255 - blue;
#endif
analogWrite(redPin, red);
analogWrite(bluePin, blue);
}
Thats no problem! I’d rather have you figure it out on your own, saves a lot of hassle later on if you grt a decent grip on things on your own. It’s how I learned too, lol. Tnx for sharing!