Hey Forum,
I'm new to arduino and have googled for the past couple of weeks to try and find some more information out about how to connect two or more arduinos together. I have seen I2C examples but nothing that gives me a clue as to how i can do my project.
The Project
The project I would like to do is a multiplayer game which is modular that has buttons and LEDS attached to each module. The reason why Id like it to be modular is if the player wanted to play on their own then they could, if they want to play multiplayer then they can plug in another module the same as the first and player against the other module. From what I have read i believe i will need a host arduino and then connect the amount of modules (players) I want to this. The problem is the host needs to send code to all the players of which button to press and then the player that replies first wins. The modules could be 2 metres away from each other and all power by wall adapters.
Everything I have seen requires a Master and then slaves but this is one way communication unless you poll the slaves from the Master. Could this lead to missing the player that responded first? Can anyone recommend a way of accomplishing this setup better than I have research. More of a anyone can shout first approach.
I am grateful for any responses
Many Thanks
benlunt:
Hey Forum,
I'm new to arduino and have googled for the past couple of weeks to try and find some more information out about how to connect two or more arduinos together. I have seen I2C examples but nothing that gives me a clue as to how i can do my project.
The Project
The project I would like to do is a multiplayer game which is modular that has buttons and LEDS attached to each module. The reason why Id like it to be modular is if the player wanted to play on their own then they could, if they want to play multiplayer then they can plug in another module the same as the first and player against the other module. From what I have read i believe i will need a host arduino and then connect the amount of modules (players) I want to this. The problem is the host needs to send code to all the players of which button to press and then the player that replies first wins. The modules could be 2 metres away from each other and all power by wall adapters.
Everything I have seen requires a Master and then slaves but this is one way communication unless you poll the slaves from the Master. Could this lead to missing the player that responded first? Can anyone recommend a way of accomplishing this setup better than I have research. More of a anyone can shout first approach.
I am grateful for any responses
Many Thanks
Set up your shared Comms, I'd go with RS485.
Have one device the 'Master'.
When the game starts, have the master synchronize all of the slaves millis() timers.
Have the 'slaves' record when their button is pressed.
The 'master' can poll each 'slave' comparing their activation times.
The 'master' would also function as a 'slave'.
Chuck.
Hey chuck thanks for your quick response it is most appreciated. Never even thought about using the logging of time that is a brill idea. Should hopefully work thanks.
Not use to rs485 but I'll do some reading up on this and try to implement what you have suggested.
First time posting on this forum very efficient
Thanks