I’m actually displaying my System Uptime using millis.
(It shows a value of DAYS:HOURS:MINUTES since the esp8266 NodeMCU’s boot time). I am aware the millis() function rolls over in about 47 days, and that it’s not an atomic clock, but it’s more than enough to debug my projects without using external hardware…
This is my dashboard…
QUESTION:
I am making use (abuse maybe ) of the “modulo” function. It sends each value to a different Cayenne Channel. This is the code snippet…
I’m pretty shure there IS a better way of doing this
(BTW, it actually works just fine and it’s really stable!)
Any ideas/suggestions for optimizing the code?
Thanks for your time guys…
Hello,
Looking for this kind of solutions I search this community and stumbled upon this conversion
@spacefolder thanks for your example I implemented it straight away after overtyping your solution (not always says a picture more than a thousand words) believe me communities (read me) are lazy and likes to cut and paste. BTW There is a dirty solution / workaround to display HH:MM in the Cayenne environment. The result will look like this:
Hi @samarchri, this is helpful though I encountered issues while copying your sketch
The first was off cource my French language skills (seulement un pitit en ecole) and an error in the sketch caused by likely our different keyboard settings where " became “ ” and produced an error. Secondly missed an important line: Cayenne.begin(username, password, clientID, ssid, wifiPassword);
Bit confusing to delete this one.
I also did this while there was likely some maintenance and numorous errors batterred me including the most simple:
Error downloading http://arduino.esp8266.com/stable/package_esp8266com_index.json
Back to your sketch:
Your frequency to refresh this is 30 seconds so why display seconds?
Your “hour”-routine becomes rather lengthy, my version (skipping the seconds) would only take an 1-liner: time_now_d = dateTime.hour * 1.0 + ( dateTime.minute / 100.0);
Your transform string part was good ecucation for me (hope to remember it) so thanks for your input.
@wj4me sorry for errors (mising Cayenne.begin) i pick some piece of code without testing it entirely
this package got probleme last time, i tried this one https://github.com/esp8266/Arduino/releases/download/2.3.0/package_esp8266com_index.json and its ok
30s is an example. If i would refresh all 10s i’ll see new data received well because of display seconds.