-
Notifications
You must be signed in to change notification settings - Fork 20
Pin Assignments
micromouseonline edited this page Oct 26, 2019
·
2 revisions
The UKMARSBOT robot PCB assigns specific roles to most of the input and output pins. As these are fixed, it is important to use the correct pins for the assigned functions. To help in programming, these pins have been allocated meaningful names as shown below. Include this section of Sketch code below at the start of your program to make these standard names available for use in your program
// Input pins:<br />
int lside = A0; // left side sensor input
int rfront = A1; //front left line sensor input
int lfront = A2; //front right left sensor input
int rside = A3; // right side sensor input
int sens1 = A4; // unassigned sensor input 1
int sens2 = A5; // unassigned sensor input 2
int fourwayswitch = A6; // input from function switch
int battery = A7; // input for battery measurement
int Receive = 0; // Receive pin
int Transmit = 1: // Transmit pin
int m1encoder1 = 2; // motor 1 encoder 1 input interrupt pin
int m1encoder2 = 4; // motor 1 encoder 2 input
int m2encoder1 = 3; // motor 2 encoder 1 input interrupt pin
int m2encoder2 = 5; // motor 2 encoder 2 input
// Output pins:
int sensorLED1 = 6; // 1st diagnostic LED on sensor board
int lmotorDIR = 7; // Left motor dirn input 1
int rmotorDIR = 8; // Right motor dirn input 3
int lmotorPWM = 9; // Left motor PWN pin<br />
int rmotorPWM = 10; // Right motor PWN pin<br />
int sensorLED2 = 11; // 2nd diagnostic LED on sensor board<br />
int trigger = 12; // trigger for sensor LEDs<br />
int LED13 = 13; // ext LED Red<br />
In the void setup () section of your program also include the following section of Sketch code:
pinMode(sensorLED1, OUTPUT);
pinMode(lmotorDIR, OUTPUT);
pinMode(rmotorDIR, OUTPUT);
pinMode(lmotorPWM, OUTPUT);
pinMode(rmotorPWM, OUTPUT);
pinMode(sensorLED2, OUTPUT);
pinMode(trigger, OUTPUT);
pinMode(LED13, OUTPUT);
pinMode(m1encoder1, INPUT);
pinMode(m1encoder2, INPUT);
pinMode(m2encoder1, INPUT);
pinMode(m2encoder2, INPUT);
Also include this next line in the void setup()
section to allow the serial monitor to work
Serial.begin(9600); // set up serial monitor comms on USB
Getting Started Pages
Building Guide
- Tools and Materials
- Assemble the main board
- Addendum for V1.3a main board
- Assemble the basic line sensor
- Assemble the mini wide line sensor board
- Assemble the basic wall sensor
- Mounting sensor boards
- Choosing motors
- Fitting Encoders
- Mounting the motors
- Choosing batteries
- Mounting the battery
Reference Pages
Troubleshooting
Developer Notes