0 votes
5.1k views
in Arduino by
Is it possible to detect Serial1 is present on an arduino board, and if Serial1 is not available use Serial itself? Idea is to make a single program which can run on both UNO and MEGA so that I have to look after the pins only during production, and the software will cares the rest. Please let me know your thoughts on this.

1 Answer

0 votes
by

This is not a simple way.Because the compiler will check your program When you program is building.It would throw a error When your select uno board in the IDLE but use Serial1 in your program.The compiler don't know what Serial means when you select uno board in the IDLE.Beacause Serial1 not in compiler preset file.

Useing software Serial is a Not bad way to deal with your question.See thishttps://www.arduino.cc/en/Tutorial/SoftwareSerial

Hope you will success deal with question

Related questions

+2 votes
1 answer 7.8k views
asked Mar 15, 2017 in Arduino by Manoj
0 votes
2 answers 8.1k views
asked Aug 1, 2017 in Arduino by nwbi
+2 votes
1 answer 971 views
0 votes
1 answer 586 views
0 votes
1 answer 596 views
0 votes
1 answer 3.7k views
...