I’m starting to understand how things work in Node.js. Just wrote a little module to take serial output from the RF12demo sketch and decode its “OK …” output lines:
Sample output:
This quick demo only has decoders for nodes 3 and 9 so far, but it shows the basic idea.
This relies on the EventEmitter class, which offers a very lightweight mechanism of passing around objects on channels, and adding listeners to get called when such “events” happen. A very efficient in-process pub-sub mechanism, in effect!
Here is the “serial-rf12demo” module which does the rest of the magic:
And that’s really all there is to it – very modular!
Hi,
Are you not going to use databases for datacollection and push/pull from there, making this code obsolete? Or is this just a learning exercise?
Either way, I’m going to need to interface to a JeeNode/JeeLink over serial, and decode the incoming bytes. So yeah, I’m learning – but also building the blocks I’ll need anyway.
Everything is relatively easy until you have to deal with concurrent requests. I wonder how fast node.js is on embedded arm hardware.
Given that I’d just started looking at doing this in Python, I think I’ll learn some node.js instead :-)