Refactored the Java code, applied communication port checks, added a
Java Arduino class to handle constants used in the Arduino code in one
place in the Java code and optimized the Arduino code to handle
everything based on the FIRST_PIN and MAX_PIN values dynamically.