I made a program to read temperature with the DHT11 and to light a led with a push button and I used a HC-06 Bluetooth to make the connection with the Blynk.
Testing the software by removing Blynk.begin. The arduino works correctly, but when I enable Blynk.begin does not do anything else and only via blynk turns on and turns off my led.
I was about to comment on that I haven’t seen timers setup this way before… will that work?
void setup()
{
// other stuff
startTimers();
// other stuff
}
void startTimers(void)
{
timer.setInterval(READ_BUTTONS_TM*1000, readLocalCmd); // Read buttons at every x seconds
timer.setInterval(READ_AIR_DATA_TM*1000, getDhtData); // Read DHT Sensor at every x seconds
timer.setInterval(SEND_DATA_BLYNK_TM*1000, sendUptime); // Send Data to blynk at every x seconds
}
And possibly unrelated to your connection issue, but DHT11 is a notoriously slow sensor… i would give it between 2-5 seconds for read cycles.
I’ve never done (or seen) it that way either. Seems like a little more work than just putting them in the setup()
void setup()
{
pinMode(LAMP_PIN,OUTPUT);
pinMode(LAMP_ON_BUTTON,INPUT_PULLUP);
timer.setInterval(READ_BUTTONS_TM*1000, readLocalCmd); // Read buttons at every x seconds
timer.setInterval(READ_AIR_DATA_TM*1000, getDhtData); // Read DHT Sensor at every x seconds
timer.setInterval(SEND_DATA_BLYNK_TM*1000, sendUptime); // Send Data to blynk at every x
Serial.begin(9600);
SerialBLE.begin(9600);
Blynk.begin(SerialBLE, auth);
dht.begin();
LEDs.off();
LEDa.off();
}
Also, it is good form to put a “L” on the time for the timers
OK, well BLE/BT is in beta still, and I personally have noticed that it tends to be a bit unstable with lots of things happening… perhaps your “timing” might be putting it off??
Have you setup the BLE widget properly in the app?
Ah, now i see, you are multiplying the define by 1000… ok. But as @Toro_Blanco mentioned Timer uses LONG integer, so it should have the L in there… but how that affects the rest of the math… iduno
OK, sounds like a timing issue… i had similar reactions trying to run servos using the BLE/BT connections, it seemed to lock up the connection for some of the processes.
All I can recommend is scale a test project down to one thing at a time and slowly add to it and see how it reacts.