Each pin on the micro-controller is mapped to perform a certain operation. The pins of a micro-controller are called General Purpose Input Output (GPIO) pin.
The following mapping helps us in programming the board. Dx indicates Digital Pins while Ax indicates Analog pins:
To make programming simpler, we can create a config.h file where all the pin-outs are mapped to their usage in the board.
/** config.h : A configuration file to map pinouts in micro:Xbot** At VEEROBOT, we invest time and resources providing this open source code,* Please support VEEROBOT and open-source hardware by purchasing products* from us @ http://veerobot.com* -----------------------------------------------------------------------------* You are free to redistribute it and/or modify it under the terms of the GNU* Lesser General Public License as published by the Free Software Foundation,* either version 3 of the License, or (at your option) any later version.** This Code is distributed in the hope that it will be useful,* but WITHOUT ANY WARRANTY; without even the implied warranty of* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the* GNU Lesser General Public License for more details.** See <http://www.gnu.org/licenses/>*/#ifndef_CONFIG_H#define_CONFIG_H#defineSTX D2 // Software Serial Tx Pin#defineSRX D3 // Software Serial Rx Pin#defineEN15 // Motor 1 PWM Pin#defineEN26 // Motor 2 PWM Pin#defineIN14 // Motor 1 Direction Pin#defineIN27 // Motor 2 Direction Pin#defineLDR1 A6 // Right LDR Sensor#defineLDR2 A7 // Left LDR Sensor#defineIRRX8 // IR Receiver#defineBUZZ9 // Buzzer Output#defineLED_BUILTIN10 // LED Pin#defineTRIG11 // Trigger Pin for Sonar#defineECHO12 // Echo Pin for Sonar#defineRGB13 // RGB LED Output#defineLF1 A0 // Right IRRX Module#defineLF2 A1 // Center IRRX Module#defineLF3 A2 // Left IRRX Module#defineBV A3 // Battery Voltage Pin#defineSDA_PIN A4 // Right LDR Sensor#defineSCL_PIN A5 // Left LDR Sensor#defineMAX_DISTANCE500 // We will use this for maximum Sonar distance// We will use the below enum to define different RGB ColoursenumRGBColor { UNDEF, RED, ORANGE, YELLOW, GREEN, BLUE, PURPLE, WHITE, BLACK };#endif // _CONFIG_H