Connect Mega 2560 with Duemilanove via Serial

Hi,

I'm new to the Arduino. I have a Mega with several sensors, mostly for monitoring currents and voltages, but now I've come across a LCD with Touch screen for it. The problem is it uses ALL of the digital pins, as well as some PWM pins on my Mega.

I have to consider adding another Arduino since the sensors are digital. I already got Duemilanove so I was wondering how to connect them? Duemilanove would read the sensors, whereas Mega will have the touch, display and possible actuators(I still have 6 PWM left).

I ask for a thorough explanation because I don't understand microprocessors very well.

Thanks...

You start off by asking how to connect the two Arduinos by serial. There are three ways to connect the two Arduinos - I2C, SPI, and serial. Which one would work best depends on what you intend to send between the two Arduinos - how much data, how often.

Assuming you do want to use serial, connect TX on the Duemilanove to RXN on the Mega. Connect RX on the Duemilanove to TXN on the Mega. Connect Gnd on the Duemilanove to Gnd on the Mega.

Use Serial.begin(), Serial.available(), Serial.read(), Serial.write(), Serial.print(), and/or Serial.println() to send data from the Duemilanove to the Mega, and to read the responses.

Use SerialN.begin(), SerialN.available(), SerialN.read(), SerialN.write(), SerialN.print(), and/or SerialN.println() to send data from the Mega to the Duemilanove, and to read the responses, where N is the serial port you connected the Duemilanove to.

Thank you for your fast reply. Data is to be sent 2-3 times per second. It's just simple integer values. It would be nice to do some PWM output, but I must see if the connection can handle it in real-time. I'll get back as soon as I try it out.

It's just simple integer values.

In ASCII or binary? Neither is trivial to handle via the serial port. Not terribly difficult, but not trivial, either.