Its now under PrintDate(LCD6) and PrintSchedule(LCD7).
I aslo seem to be having trouble in the ConvM2C, where it updates the char* AP but not the int nhr after being called.
Thanks for looking at it
/*
* Tryin to get data from two sliders(V3&V4) and then display those values back to test LCD function using LCDs on V2&V5
*/
#define BLYNK_PRINT Serial // Comment this out to disable prints and save space
#include <SPI.h>
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <SimpleTimer.h>
#include <TimeLib.h>
#include <WidgetRTC.h>
//-------------------------------------------------------------------------------------------------------------------------------------
char auth[] = "your auth number here"; // Auth Token Blynk App.
SimpleTimer timer;
WidgetRTC rtc;
BLYNK_ATTACH_WIDGET(rtc, V3);
int SttHrM;
int SttHrC;
int SttMin;
int StpHrM;
int StpHrC;
int StpMin;
int AutoSttHr;
int AutoSttMin;
int CustSttHr;
int CustSttMin;
int AutoStpHr;
int AutoStpMin;
int CustStpHr;
int CustStpMin;
int Mode;
int Latch;
int Test;
int Nhour;
char AmPm[5];
char AmPmStt[5];
char AmPmStp[5];
//------------------------------------------------------------------------------------------------
//*************************************** Print Time and Date
void PrintDate(){
WidgetLCD lcd(6);
lcd.clear();
ConvM2C(Nhour,hour(),AmPm);
lcd.print(1, 0, Nhour);
lcd.print(4, 0, minute());
lcd.print(7, 0, second());
lcd.print(10, 0, AmPm);
lcd.print(3, 1, day());
lcd.print(6, 1, month());
lcd.print(9, 1, year());
}
//*************************************** Print the Start and Stop Schedule
void PrintSchedule(){
WidgetLCD lcd(7);
lcd.clear();
ConvM2C(SttHrC,SttHrM,AmPmStt);
lcd.print(0, 0, "Start- ");
lcd.print(7, 0, CustSttHr);
lcd.print(9,0,":");
lcd.print(10,0, SttMin);
lcd.print(12,0, AmPmStt);
ConvM2C(StpHrC,StpHrM,AmPmStp);
lcd.print(0, 1, "Stop- ");
lcd.print(7, 1, StpHrC);
lcd.print(9,1,":");
lcd.print(10,1, StpMin);
lcd.print(12,1, AmPmStp);
}
//****************************************** Check Mode And Set Schedule
void SetSchedule(){
if ( Mode == 0){
SttHrM = AutoSttHr;
SttMin = AutoSttMin;
StpHrM = AutoStpHr;
StpMin = AutoStpMin;
}
else{
SttHrM = CustSttHr;
SttMin = CustSttMin;
StpHrM = CustStpHr;
StpMin = CustStpMin;
}
}
//****************************************** convert time from military to civilian
void ConvM2C(int nhr, int hr, char* AP){
if (hr > 12){
nhr = hr - 12;
strcpy (AP,"P.M.");
}
else {
nhr = hr;
strcpy (AP,"A.M.");
}
}
//********************************** Dummy Auto Times
void DummyAuto(){
AutoSttHr = 21;
AutoSttMin = 0;
AutoStpHr = 9;
AutoStpMin = 30;
}
//---------------------------------------------------------------------------------------------------------------------------------------------------------
BLYNK_WRITE(V0) {
Mode=param.asInt();
}
BLYNK_WRITE(V1) {
Latch=param.asInt();
}
BLYNK_WRITE(V2) {
Test=param.asInt();
}
//*************************************** Get and manange Custom Start time data
BLYNK_WRITE(V4) {
int CustStart = param.asInt();
CustSttHr = CustStart/100;
CustSttMin = (CustStart - CustSttHr*100);
if (CustSttMin > 59){
CustSttMin = 0;
CustSttHr = CustSttHr + 1;
}
}
//************************************** Get and manage Custom Stop time data
BLYNK_WRITE(V5) {
int CustStop = param.asInt();
CustStpHr = CustStop/100;
CustStpMin = (CustStop - CustStpHr*100);
if (CustStpMin > 59){
CustStpMin = 0;
CustStpHr = CustSttHr + 1;
}
}
//----------------------------------------------------------------------------------------------
void setup()
{
Serial.begin(115200);
Blynk.begin(auth, "SSID","PASSWORD");
// timer.setInterval(10, uselcd5); // uncomment and comment out loop function call of uselcd5 to put function on timer
while (Blynk.connect() == false) { // Wait until connected
}
rtc.begin();
}
//-------------------------------------------------------------------------------------------------
void loop(){
// int hold=0;
// while (hold ==0){
BLYNK_CONNECTED();
if (true) {
Blynk.syncAll();
}
DummyAuto();
SetSchedule();
PrintDate();
PrintSchedule();
Blynk.run();
timer.run();
}
// }