VEEROBOT Docs
StoreBlogWiki
  • 🌐Introduction
  • ROS Based Robots
    • 🐺Wolf Robot
      • ROS Introduction
      • Getting Started with ROS 2
      • Introduction to Wolf Robot
      • ROS 2 Setup
      • ROS Concepts
      • Using Wolf Examples
      • Creating a URDF File
      • Visualising in Gazebo
      • Controlling motors from ROS
      • LiDAR Basics & Control
      • Using a Camera with ROS2
      • ROS 2 Cleanup
      • ROS 2 Controller
      • Teleoperation
      • Slam Navigation
      • Wolf : Conclusion
  • Arduino Based Robots
    • 🚜Micro:Xbot
      • Preparations before First Use
      • Programming the Board
      • Powering the Board
      • Pin Mapping
      • Basic Programs
        • Blinking LED
        • Buzzer Program
        • Fading LED
        • RGB LED
        • Light Detection
        • Battery Voltage
        • Line Follower Module
        • Ultrasonic Sensor
        • Infrared Remote Control
        • Motor Control
        • Bluetooth Control
        • Display Test
        • Test Me
      • Robot Assembly
      • Advanced Programs
        • Bluetooth Controlled Robot
        • Obstacle Avoidance Robot
        • Line Follower Robot
  • ROS2 Repo
    • Introduction
    • Page 1
      • Sub Page 1
    • Page 2
Powered by GitBook
On this page
  1. Arduino Based Robots
  2. Micro:Xbot

Pin Mapping

PreviousPowering the BoardNextBasic Programs

Last updated 2 years ago

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

#define STX D2           // Software Serial Tx Pin
#define SRX D3           // Software Serial Rx Pin

#define EN1 5            // Motor 1 PWM Pin
#define EN2 6            // Motor 2 PWM  Pin
#define IN1 4            // Motor 1 Direction Pin
#define IN2 7            // Motor 2 Direction Pin

#define LDR1 A6          // Right LDR Sensor
#define LDR2 A7          // Left LDR Sensor

#define IRRX 8           // IR Receiver

#define BUZZ 9           // Buzzer Output

#define LED_BUILTIN 10   // LED Pin

#define TRIG 11          // Trigger Pin for Sonar
#define ECHO 12          // Echo Pin for Sonar

#define RGB 13     	 // RGB LED Output

#define LF1 A0   	 // Right IRRX Module
#define LF2 A1   	 // Center IRRX Module
#define LF3 A2   	 // Left IRRX Module
#define BV A3    	 // Battery Voltage Pin
#define SDA_PIN A4   	 // Right LDR Sensor
#define SCL_PIN A5   	 // Left LDR Sensor

#define MAX_DISTANCE 500 // We will use this for maximum Sonar distance

// We will use the below enum to define different RGB Colours
enum RGBColor { UNDEF, RED, ORANGE, YELLOW, GREEN,  BLUE, PURPLE, WHITE, BLACK };

#endif // _CONFIG_H

🚜
Arduino - Atmega328 Pin Mapping