hi, im trying to know if a service is expired or up to date according to a date.
i think the code its correct up to the param. part that i dont understand it
ill try first to explain you what i meant to do and then paste the code
im trying to know if a service its expired or not according to a date (7 of the month) using virtual rtc
so: -if date is bigger or equal to 7 and the button “allready payed” its off (v88), means its expired so i need the labeled value (V89) to say “expired”
- if date is bigger or equal to 7 but the button "allready payed " its on (v88), means its up to date, so i need labeled value (v89)
-and if its not yet 7 then “just up to date” (v89)
indent preformatted text by 4 spaces
indent preformatted text by 4 spaces
<#define BLYNK_PRINT Serial
°°°|||#include <Ethernet.h>
#include <BlynkSimpleEsp8266.h>
#include <ESP8266WiFi.h>
//#include
#include "TimeLib.h"
#include <WidgetRTC.h>
int buttonState = param.asInt();
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "................";
char ssid[] = ".............";
char pass[] = "........";
BlynkTimer timer;
WidgetRTC rtc;
// Digital clock display of the time
void clockDisplay()
{
// You can call hour(), minute(), ... at any time
// Please see Time library examples for details
String currentTime = String(hour()) + ":" + minute() + ":" + second();
String currentDate = String(day()) + " " + month(); //+ " " + year();
Serial.print("Current time: ");
Serial.print(currentTime);
Serial.print(" ");
Serial.print(currentDate);
Serial.println(" ");
// Send time to the App
Blynk.virtualWrite(V1, currentTime);
// Send date to the App
Blynk.virtualWrite(V2, currentDate);
}
BLYNK_CONNECTED() {
// Synchronize time on connection
rtc.begin();
}
void setup()
{
// Debug console
Serial.begin(9600);
Blynk.begin(auth, ssid, pass);
// Other Time library functions can be used, like:
// timeStatus(), setSyncInterval(interval)...
// Read more: http://www.pjrc.com/teensy/td_libs_Time.html
setSyncInterval(10 * 60); // Sync interval in seconds (10 minutes)
// Display digital clock every 10 seconds
timer.setInterval(10000L, clockDisplay);
}
void loop()
{ Blynk.run();
timer.run();
if ((day() >=7 )&& buttonState(V88 == HIGH)){
Blynk.virtualWrite (V89, "AL DIA");
}
if ((day() >=7 ) && (buttonState(V88 == LOW ))
{
Blynk.virtualWrite (V89, "VENCIDO");
}
if (day() <7)) {
Blynk.virtualWrite (V89, "AUN NO VENCIO");
}
}