i am trying to migrate my designs from the particle cloud and p0 mcu, to the esp32 platform and mongoose OS. while i understand the concepts, the api is a bit different and i am having trouble converting my code from the previous platform. this is just an excerpt of what i am after. also, i dont quite get where my voids are, which one is for one time variables (setup), which one loops (loop)?
simple things like mqtt sub/pub, reading values etc, are not so obvious to me now.
yes, followed the guides rather extensively, but adding features is boggling me. MQTT for example, yes, the examples work, but if I try to use the example code on the demo app, nothing happens. I’m fairly positive that I put the sub/pub on teh wrong section, but I dont have a “void loop” so I’m stuck. I’ll give the advanced doc a read now too, thanks!
C code, here is my app init. I have a MQTT server on my private network that I am trying to get this talking to. credentials and address are in my mos.yml already
got it, i added the port to my server define, which is the default, but weird, ok, good here not to get my subscribe parser implemented thanks for the help!
its supposed to work taht way accoring to the docs, but I added 1883 and it fired right up…
on the loop part, so I can just create a void loop() and it would work? sorry, not a real programmer, learning by trial and error still.
I found that starting with mjs a bit less of a struggle getting things to work. Then adding in c calls as needed. No main loop needed with mjs. Stick to timers and events then. Mjs has lots of hooks.
ah, cool. ok, last question for now, hopefully. Is there a list or document of all the internal calls? if i want to use the DeviceID, or MAC, or uptime, etc, as a varible? if you know particle, I want to do this with Mongoose:
Mjs:
Use let w=Cfg.get (‘mqtt.whatever’), w has whatever in it. Similar call for c code.
Device Id has a value use mos config-get to see.
Never seen particle.
Something like that for every variable in config-get. You can also create your own vars in yml file. Need quotes around var in call.
Also in yml file the ??? Are derived from Mac address. Removing and adding ??? Sub in from the
Mac.
See config-get for ssid for example.