I'm pretty new to the IOT/Arduino/ESP world and trying to play around with it for a couple of weeks.
In the meanwhile I got some things working already - however I'm a bit overwhelmed now.
Here's what I try to do:
I have a NodeMCU ESP-12e dev board and use Arduino IDE to program it. So far I used the modules to read temperature sensor data and publish it via mqtt to my raspberry pi. also I used my raspberry pi to send mqtt messages to the ESP-12e board to turn on/off leds. that worked fine.
For a current project I need the time, a LED matrix and MQTT. I want to display the time on a self made NeoPixel LED strip matrix and simultaneously listen send temperature data via MQTT and listen to MQTT for color changes/ mode changes and so on.
The single pieces are working more or less. - the clock is doing it's thing and MQTT is doing it's thing - however when I put it together MQTT is reacting really slow, sometimes missing incoming messages.
#include <ESP8266WiFi.h> //WiFi
#include <PubSubClient.h>
#include <DHT.h> //Temperature Sensor
#include <Adafruit_NeoPixel.h> //LEDs
#include <TimeLib.h> //Time
#include <WiFiUdp.h> //Synchronize Time
void loop() {
// LOOP MQTT
if (!client.connected()) {
reconnect();
}
clock(); // --> Clock.ino
client.loop();
delay(10); //I did read somewhere a delay of 10 is positive here, tried 10, 100, 300,... nothing - It doens't seem to change anything
}
As you can see I'm calling all in the loop function. While further reading I found this about interrupts https://learn.adafruit.com/multi-taskin ... -interrupt is this the solution to my problems? to I have to change from every function within "loop" to something different?
Can I use the interrups from the tutorial with the ESP-12e? because I didn't get it to work.
I then found the #include <Ticker.h>. Is this "interrups" for ESP-12e?
I tried using it to call my clock function
flipper.attach(1, modeChanger);
So long story short:
- Is my project oversized for the ESP-12e board?
- Are interrupts/ticker the solution to my problem (if used correctly)?
Thanks for any advice and tips