I'm playing around with the split node using space as the splitter, but then I need to put the two parts into a single message as msg.lat and msg.lon.
What's the simplest method? Send each to a variable then use a function node to re-combine the two messages into a single one? I'm thinking there might be a simpler way.
TIA
Damn - you are too quick. I was just typing my response (same as yours) and you beat me to it.
I suppose that's something to do with "youth" compared with "old age".
Awesome, works well thanks. If I want to put the lat and lon in an array under msg.payload, would I just add {} around the function, with a , between them?
So, I changed the msg.lat/lon to variables var and included them in the array.
Now I get them in the array.
I need to investigate the const function, I have no idea how it split the two values out, unless the space in the "" was used as the delimiter? If so, I assume its a version of the split node?
Ahh makes sense now then. So the [0][1] are because we know there is only one space in the string, thus can only be two outputs in the array.
So the .split does the splitting...
That makes sense too. I've always used var, I forget there are other types that can be used.
The other problem is... Node-RED is so addictive, once you get up the learning curve and discover how quickly and easily you can create a flow to control something; report something; display something.
It's also great to see what other people have done and think... "now why didn't I think of that clever idea?"
Haha, I'm 62 and certainly constantly forgetting and learning. It's what keeps us young at heart
I do recommend finding a short JavaScript course or two to run through, it really helps cement some of the basics and gives you a better grounding for doing internet searches for all the things you wont remember. I forever have to look up simple things because I'm not a full-time dev and haven't been for many decades now. Thankfully JS has some great resources such as the fantastic Mozilla Developer Network (MDN) which is the go-to place for the JS language, both for references and for tutorials/training. Microsoft also have a nice and free online JS course.
How very true! It lets you be so creative as it takes care of most of the boring bits for you.
Programming is my personal creative outlet. I can't sew like my wife can, and I'm generally rubbish with my hands, so programming is it.