Two Serials on Mega 2560


I want to make a code that based on your heart beat BPM will make a dmx rgb led to change colors. I connected a dmx shield and a pulse sensor to my UNO board. If I run the two codes separately (pulse sensor, dmx shield) everything works fine. When I combine the two codes, each one of them needs to have a serial, so, the two use the same serial and nothing really works. So, now I bought a Mega 2560 that has multiple serials and here I want your help: How can I make separate serials for the two (pulse sensor, dmx shield) in order for each one to work fine?


I'd say change all the Serial for one of them to Serial1 and for the other to Serial2, and attach your devices to the appropriate pins. Leave Serial vacant for monitor debugs.

Did you study the Mega's MultiSerial example that comes with the IDE?