Is there any way to use Serial.print in void loop? im making a smart terrarium with blynk and when the code Blynk.begin(SerialBLE, auth); is in setup my print is blocked, even when im connected vai BT with app print in void loop is still ‘blocked’ but print in any function of blynk works normally (BLYNK_WRITE(V20)). Im using hm-10 and i know blynk have some isse with this BT.
When i turn on #define BLYNK_PRINT Serial, serial stuck on Login timeout and Connecting… loop. But ofc bt is connected and works fine.
//#define BLYNK_PRINT Serial
#define RedP 9
#define GrnP 10
#define BluP 11
#include "RTClib.h"
#include <Wire.h>
RTC_DS1307 rtcc;
#include <SoftwareSerial.h>
SoftwareSerial SwSerial(2, 3); // RX, TX
#include <BlynkSimpleSerialBLE.h>
int s = 61;
char auth[] = "*********************";
SoftwareSerial SerialBLE(2, 3); // RX, TX
int rrr = 0;
int ggg = 0;
int bbb = 0;
void setup()
{
analogWrite(RedP, rrr); // Write to RED RGB pin.
analogWrite(GrnP, ggg); // Write to GREEN RGB pin.
analogWrite(BluP, bbb); // Write to BLUE RGB pin.
Serial.begin(9600);
SerialBLE.begin(9600);
Blynk.begin(SerialBLE, auth);
if (! rtcc.begin()) {
Serial.println("Couldn't find RTC");
Serial.flush();
}
if (! rtcc.isrunning()) {
Serial.println("RTC is NOT running, let's set the time!");
rtcc.adjust(DateTime(F(__DATE__), F(__TIME__)));
}
}
void loop()
{
DateTime noww = rtcc.now();
if(noww.second() != s){
Serial.print(noww.hour(), DEC);
Serial.print(':');
Serial.print(noww.minute(), DEC);
Serial.print(':');
Serial.print(noww.second(), DEC);
Serial.println();
s= noww.second();
}
Blynk.run();
}
BLYNK_WRITE(V20) // RED slider
{
Serial.print(':'); //here works fine
rrr = param.asInt();
Blynk.virtualWrite(V23, rrr);
RGBprocess();
}
BLYNK_WRITE(V21) // GREEN slider
{
ggg = param.asInt();
Blynk.virtualWrite(V24, ggg);
RGBprocess();
}
BLYNK_WRITE(V22) // BLUE slider
{
bbb = param.asInt();
Blynk.virtualWrite(V25, bbb);
RGBprocess();
}
BLYNK_WRITE(V2) // zeRGBa widget
{
rrr = param[0].asInt();
ggg = param[1].asInt();
bbb = param[2].asInt();
Blynk.virtualWrite(V20, rrr);
Blynk.virtualWrite(V23, rrr);
Blynk.virtualWrite(V21, ggg);
Blynk.virtualWrite(V24, ggg);
Blynk.virtualWrite(V22, bbb);
Blynk.virtualWrite(V25, bbb);
RGBprocess();
}
void RGBprocess()
{
analogWrite(RedP, rrr);
analogWrite(GrnP, ggg);
analogWrite(BluP, bbb);
}