Hi!
I'm trying to make my first wireless project and need some help
My idea is to make a "simple" game with 2 transmitters (with 1 Arduino Nano, NRF24L01 and 1 button) and 1 receiver.
So, here's the rules:
if "player 1" hits Button on Transmitter 1, Receiver turn on the Red Led
if "player 2" hits Button on Transmitter 1, Receiver turn on the green Led
if "player 1" and "player 2" hits at the same time (within 1 second), blink both leds
That's it!
My issues:
Not sure how to connect 2 transmitters to one receiver
Not sure how to make the "draw" to count time in case they hit at the same time.
It won't be at all straightforward to deal with two buttons pressed at the same time, or nearly at the same time. That sort of thing is much easier if both buttons connect to the same Arduino.
Using wireless the big problem is that if both transmit at the same time, or even if the transmissions partly overlap everything will be garbage and nothing will be received.
The simple way to avoid data collisions is to have a master and 2 slave system in which the master talks to each slave in turn. But, clearly, that makes little sense if you want to detect which button was pressed first.
You could, perhaps, develop a system in which the 2 slaves save the value of micros() immediately after each reply and also record in a separate variable the value of micros() when the button was pressed. If it sends both values when next requested by the master it may be possible to figure which button was pressed first or if both were pressed within X microseconds of each other.