Hi all,
I really, really tried. I looked at many examples for hours
. They either are calling objects/libraries I do not want to get into (or I feel I'll waste another couple of hours down a rabbit hole), or the examples simply do not apply to my use case.
To add insult to injury, I have a COM port issue which fails to open to let me access the serial monitor. I have spent another couple of hours trying to fix this. I've read some post about a driver rollback but the website it refers is 404... Plus, the only way I can upload a sketch to my chip is using esp8266 v2.4.2. Old version! Anything over that and I have errors and cannot upload anything. These are not what I need help with, but I want to provide context.
Clearly I'm fighting an uphill battle to get something very simple working. I can see the day where I'll get tired of this hobby as too many times I just feel like this is a boxing match in the dark, with limited debugging tools. I need to step back from the fight and reachout for help.
I have a Lolin NodeMCU v3 (ESP8266). I can write to it using v.2.4.2 of the esp8266 board.
I am receiving a MQTT message which contains a payload that I want to read into an integer. This integer would be the number of minutes my alarm would ring (I trigger a relay), so the value will never be more than 0-15. Naturally I also check the topic value.
>mosquitto_pub -t 'home/alarm/cmd' -m '4'
Would ask the module to trigger an alarm for 4 minutes.
I am using this callback function which works. I can successfully get the message and validate the topic using strcmp( ).
However I am always getting a "0" or "loglogloglog" when I ty to convert the value.
I am using this function constructor for the callBack( )
void callback(char* topic, byte* payload, unsigned int length)
I just want that byte* into an int variable
Any help is greatly appreciated
edit: fixed to list esp8266 instead of esp32

