Category : arduino-esp8266

I’m working a code to pubsub over GSM SIM800L and ARDUINO MEGA. I’m able to workout MQTT fine, using ElementzOnline / SIM800_MQTT code. I’m now having trouble to use MQTT alongside SMSReading (+CMT). I’ve made a RecSMS() to receive incoming messages, and it works fine as long as TCP Connection is not true. My Code ..

Read more

const String roomname_short = "Test"; void setup() { Serial2.begin(9600, SERIAL_8N1, RXD, TXD); Serial.begin(115200); //Serial2.write("A"); Serial2.println((READY_MESSAGE)); Serial.println(READY_MESSAGE); } void loop() { char c; String readString; while (Serial2.available()) { c = Serial2.read(); readString += c; } if (readString.length() >= 10) { if (readString.substring(1, 9) == "INTERNAL") { readString = ""; } } if (readString.length() > 0) { ..

Read more

I have the following C++ classes: This first class is an abstract class and should not be instantiated directly: class Logger { public: enum LogLevel { Error, Info, Debug }; virtual void log(const char *str, const LogLevel log_level) const; virtual ~Logger() = default; protected: Logger() = default; }; Then we have one child class that ..

Read more

I declared a 2D array and a pointer to it in the header file and defined them in the .cpp file as follows. my header file: extern byte GeneralBitmap[][Heigth]; extern byte (*GeneralBitmap_ptr)[][Heigth]; and my cpp file: byte GeneralBitmap[Width][Heigth]; byte (*GeneralBitmap_ptr)[Width][Heigth] = &GeneralBitmap; But the compiler returns this error: error: conflicting declaration ‘byte (* GeneralBitmap_ptr)[320][4]’ byte ..

Read more

I’ve encountered something odd which I dont understand in the below code #include <EEPROM.h> struct Settings { char stringy[24] = "initial"; }; void setup() { Serial.begin(74880); EEPROM.begin(100); Settings s; strncpy(s.stringy, "a string", sizeof(s.stringy)); EEPROM.put(0, s); Settings s3 = readSettings(); Serial.println(s3.stringy); } Settings& readSettings() { Settings s2; Serial.println(s2.stringy); EEPROM.get(0, s2); delay(1); return s2; } void loop() ..

Read more