Thank you for repl.
All sketch is so long, so I write main loop only.
void loop ( )
{
// server or Blynk mode
if (serverMode == 1) {
server.handleClient();
} else {
Blynk.run();
}
// Blynk command
BlkPinNew = digitalRead(BLKIN_PIN);
if ((BlkPinNew ^ BlkPinOld)) {
if (digitalRead(BLKIN_PIN) == HIGH) {
irsend.sendRawOn(&results);
} else {
irsend.sendRawOff(&results);
}
BlkPinOld = BlkPinNew;
}
ESP.wdtDisable();
// Temperture
String temperture;
if (WaitCntr1 == 0xfff) {
Wire.requestFrom(0x48, 1); // request 2 bytes from slave device #0x48
while (Wire.available()) // slave may send less than requested
{
char c = Wire.read(); // receive a byte as character
if (c > 127) {
c = (256 - c);
int temp = (int)c;
temperture = (String)temp;
temperture = "-" + temperture + " ℃";
} else {
int temp = (int)c;
temperture = (String)temp;
temperture = temperture + " ℃";
}
Serial.println(temperture);
Blynk.virtualWrite(V1, temperture);
}
WaitCntr1 = 0;
} else {
WaitCntr1++;
delay(1);
}
// IR test
if (digitalRead(MODE_PIN) == LOW) {
delay(50);
if (digitalRead(MODE_PIN) == LOW) {
if (IRtestSW == 0) {
Serial.println(“2”);
irsend.sendRawOn(&results);
IRtestSW = 1;
delay(500);
} else {
Serial.println(“3”);
irsend.sendRawOff(&results);
IRtestSW = 0;
delay(500);
}
}
}
}
My Blynk setting have 1 button & 1display.
Blynk itself moves well.
What frequency did you set for the Value Display
now, “push”.
are you saying you have a 3 second loop for the virtualWrite?
As the sketch, I use wait counter.(WaitCntr1) now limit is 0xfff & delay(1) ==> almost 3sec. this will be changed slower.
If you have a timed loop then you shoul~
Sorry, it’s difficult for me. I’m not sure frequency. What for ?
issues example:
25deg,29deg,25deg,29deg…
between 25deg and 25deg is 3sec and right temperature on the phone display.
When i use cold spray, 10deg, 29,deg, 12,deg,29,deg…like this. sometimes not 29 but 28.
On the serial monitor, . 25, 25, 25, 25 … 3sec interval.
regards,