I'm building a laser tag system, using the z3t0/Arduino-IRremote library.
So far I've managed to get 2 nanos to "fire" at each other, monitor life, shields, ammo count, and display all of it onscreen.
At the moment the IR signal sent is just junk (sendRaw()), and the receiving nano is set to react to any signal detection.
Now I could improve the system by using one of the vendor libraries, like sendNEC, and setting specific hex codes to send/receive.
What I would would like to do however, is send a packet of different values in one go.
Now, being a lowly PHP Developer by profession, what I would normally do is something like the below:
{
player: 1,
damage: 10,
type: 3
}
While I know there are a couple of JSON libraries out there for arduino i feel like this would still be a very inefficient way to transfer such simple data. Something like below would be better:
[1, 10, 3]
But I lack the fundamental understanding of IR data structure to send these 3 set of data in one go. I've gone through a couple of tutorials on SparkFun and Adafruit but there seems to be something not quite clicking with me.
I have figured out how to send a single value, then another, then another, but this would really complicate the receiving code to have to receive the first signal then wait for the following 3, not to mention the chance of packet loss.
It would be amazing if some kind soul could show an example, or to highlight the reasons why it simply won't work. Thanks guys/girls!