As i have mentioned before, I am a c# developer trying to get an ESP32 to do a lot it seems. Since I started with the Arduino, I stuck with the arduino IDE. I have questions around general c/c++ programming, and some stuff specific to the ESP32 using Arduino core.
What i am trying to accomplish:
Use an esp32 that has an ILI9341 display to control 4 SSRs, read from 4 temp sensors (1-wire), act as a PID for 2 of those SSRs, Publish and Subscribe to a Mosquitto Broker (that is in place already) over TLS 1.2 and using authentication....
I think that is it...
first off, my includes:
Code: Select all
#include <PID_v1.h> #include <PubSubClient.h> #include <Preferences.h> #include <WiFi.h> #include <WiFiClientSecure.h> #include <SPI.h> #include <Adafruit_ILI9341.h> #include <Adafruit_GFX.h> #include <OneWire.h> #include <DallasTemperature.h> #include <gfxfont.h> #include <Adafruit_FT6206.h> #include "certificates.h"
#1 - Is it better to declare all variables globally (if you can)? or use that sparingly? I have 120 lines of either variables, or #declare statements
#2 - I want to be able to grab user input the instant it happens, either through the mqtt broker or the touchscreen, would it be best to do events, or interrupts, or something else?
#3 - is there a way for me to be able to keep an eye on the heap/ram/etc. I ask that because after a little bit, my screen goes white, but the broker is still receiving data. then the whole thing will reboot.