0% found this document useful (0 votes)
3 views3 pages

Drag Racing

The document outlines a C++ project named 'DragRacerStopping' for a drag racing robot, detailing the robot's configuration and initialization code. It includes the setup of motors, sensors, and a main loop for controlling the robot's movement based on light reflectivity and bumper input. The project is authored by a team and was created on June 2, 2026.

Uploaded by

imdeveshg
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views3 pages

Drag Racing

The document outlines a C++ project named 'DragRacerStopping' for a drag racing robot, detailing the robot's configuration and initialization code. It includes the setup of motors, sensors, and a main loop for controlling the robot's movement based on light reflectivity and bumper input. The project is authored by a team and was created on June 2, 2026.

Uploaded by

imdeveshg
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Student Name: Drag Racing

Assignment:

Notes:

Project Name: DragRacerStopping

Project Type: C++

Date: Tue Jun 02 2026

Drag Racing - Page 1 of 3


1 #pragma region VEXcode Generated Robot Configuration
2 // Make sure all required headers are included.
3 #include <stdio.h>
4 #include <stdlib.h>
5 #include <stdbool.h>
6 #include <math.h>
7 #include <string.h>
8
9
10 #include "vex.h"
11
12 using namespace vex;
13
14 // Brain should be defined by default
15 brain Brain;
16
17
18 // START V5 MACROS
19 #define waitUntil(condition) \
20 do { \
21 wait(5, msec); \
22 } while (!(condition))
23
24 #define repeat(iterations) \
25 for (int iterator = 0; iterator < iterations; iterator++)
26 // END V5 MACROS
27
28
29 // Robot configuration code.
30 bumper BumperG = bumper([Link].G);
31 line LineTrackerH = line([Link].H);
32 motor MotorGroup11MotorA = motor(PORT11, ratio18_1, false);
33 motor MotorGroup11MotorB = motor(PORT20, ratio18_1, true);
34 motor_group MotorGroup11 = motor_group(MotorGroup11MotorA, MotorGroup11MotorB);
35
36
37
38 // generating and setting random seed
39 void initializeRandomSeed(){
40 int systemTime = [Link]();
41 double batteryCurrent = [Link]();
42 double batteryVoltage = [Link](voltageUnits::mV);
43
44 // Combine these values into a single integer
45 int seed = int(batteryVoltage + batteryCurrent * 100) + systemTime;
46
47 // Set the seed
48 srand(seed);
49 }
50
51
52
53 void vexcodeInit() {
54
55 //Initializing random seed.
56 initializeRandomSeed();
57 }
58
59
60 // Helper to make playing sounds from the V5 in VEXcode easier and
61 // keeps the code cleaner by making it clear what is happening.
62 void playVexcodeSound(const char *soundName) {
63 printf("VEXPlaySound:%s\n", soundName);
64 wait(5, msec);
Drag Racing - Page 2 of 3
65 }
66
67 #pragma endregion VEXcode Generated Robot Configuration
68
69 /*----------------------------------------------------------------------------*/
70 /* */
71 /* Module: Pd 3 RoboTick
s */
72 /* Author: Devesh, Saira, Helen
a */
73 /* Created: 6/2/2026 */
74 /* Description: Drag Race Final Projec
t */
75 /* */
76 /*----------------------------------------------------------------------------*/
77
78 // Include the V5 Library
79 #include "vex.h"
80
81 // Allows for easier use of the VEX Library
82 using namespace vex;
83
84 int main() {
85 // Initializing Robot Configuration. DO NOT REMOVE!
86 vexcodeInit();
87 // Begin project code
88
89 int threshold = //ADD VALUE HERE (black carpet)
90 [Link](100,percent); //mtrgrp velocity = 100%
91 [Link](brake); //mtrgrp stopping mode = brake
92 int LightNum = [Link](); //variable to measure light reflecti
vity from line tracker
93
94 //not in the forever loop because once pressed it will continue to spin
95 if ([Link]()) { // if the bumper is pressed
96 [Link](forward); //spin mtr grp forward
97 }
98
99 while (true) { //forever loop
100 if (LightNum > threshold) { //if the light reflectivity it greater than calibrat
ed threshold
101 [Link](); // stop mtr group
102 }
103 }
104 }
105 //end of program
106

You might also like