2 ATMega328's communicating via the IRremote library.

Hi there,

My name is JrDeveloper and I am new to the Arduino forum. I am a fairly experienced programmer and developer who has recently made a change to embedded systems. I am currently in the process in making a miles tag compatible laser tag system that requires the use of 2 ATMega328 micro controllers. One will handle all of the game and IR logic and the other sound and visual effects. I was wondering if I could use the IRremote library I am already using to communicate with out Infra-red senders and receivers between the chips.

A direct wire would run from pin 3(output pin) on one chip to pin 9(input pin) on the other and encode and decode Hexadecimal data using the PWM output of pin 3 that runs into pin 9. The only difference between using an IR sender and Receiver is that a wire will bridge the gap, or at least this is my theory.

Failing that is there a library that allows me to use Rx and Tx to allow communication between the two chips.

I am only 15 so please go easy on me :wink:

Thanks.

IR library, as implemented, is not for duplex communications.

Look into http://arduino.cc/en/Tutorial/MasterWriter

And Nick has a good writeup,

Consider using I2C. The library supports both master and slave. I've used this method with success.

Thanks. I'm aware that it was not designed for duplex communications I just merely wondered if I could adopt it but a library fit for the job would be more suited. Thank you both for your replies.

I2C example:
http://m.instructables.com/id/I2C-between-Arduinos/

Serial example:
http://yayrobots.com/wordpress/?p=119

EasyTransfer saves you the hassle of creating a protocol and parsing the data. It kinda acts like shared memory between the two chips.