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

VEXcode C++ Testbed LED Project

The document outlines a C++ project named 'VEXcode Project' created by a student named Ben, focusing on controlling LEDs and a motor using the VEX robotics platform. It includes code for initializing the robot configuration, generating a random seed, and executing a sequence of actions involving turning LEDs on and off and spinning a motor. The project is structured with defined functions for sound playback and robot initialization.

Uploaded by

stu231854
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)
7 views3 pages

VEXcode C++ Testbed LED Project

The document outlines a C++ project named 'VEXcode Project' created by a student named Ben, focusing on controlling LEDs and a motor using the VEX robotics platform. It includes code for initializing the robot configuration, generating a random seed, and executing a sequence of actions involving turning LEDs on and off and spinning a motor. The project is structured with defined functions for sound playback and robot initialization.

Uploaded by

stu231854
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: Ben

Assignment: Testbed LED

Notes:

Project Name: VEXcode Project

Project Type: C++

Date: Tue Jan 06 2026

Ben - Testbed LED - 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 motor RM = motor(PORT11, ratio18_1, false);
31
32 led Red = led([Link].A);
33 led Green = led([Link].B);
34
35
36 // generating and setting random seed
37 void initializeRandomSeed(){
38 int systemTime = [Link]();
39 double batteryCurrent = [Link]();
40 double batteryVoltage = [Link](voltageUnits::mV);
41
42 // Combine these values into a single integer
43 int seed = int(batteryVoltage + batteryCurrent * 100) + systemTime;
44
45 // Set the seed
46 srand(seed);
47 }
48
49
50
51 void vexcodeInit() {
52
53 //Initializing random seed.
54 initializeRandomSeed();
55 }
56
57
58 // Helper to make playing sounds from the V5 in VEXcode easier and
59 // keeps the code cleaner by making it clear what is happening.
60 void playVexcodeSound(const char *soundName) {
61 printf("VEXPlaySound:%s\n", soundName);

Ben - Testbed LED - Page 2 of 3


62 wait(5, msec);
63 }
64
65 #pragma endregion VEXcode Generated Robot Configuration
66
67 /*----------------------------------------------------------------------------*/
68 /* */
69 /* Module: [Link] */
70 /* Author: {author} */
71 /* Created: {date} */
72 /* Description: V5 project */
73 /* */
74 /*----------------------------------------------------------------------------*/
75
76 // Include the V5 Library
77 #include "vex.h"
78
79 // Allows for easier use of the VEX Library
80 using namespace vex;
81
82 int main() {
83 // Initializing Robot Configuration. DO NOT REMOVE!
84 vexcodeInit();
85 // Begin project code
86
87 [Link]();
88 [Link](20,percent);
89 [Link]();
90 wait(5,seconds);
91 [Link]();
92 wait(3,seconds);
93 [Link]();
94 wait(5,seconds);
95 [Link]();
96 [Link](forward);
97 wait(3,seconds);
98 [Link]();
99 [Link]();
100
101
102
103
104 }
105
106
107
108
109
110
111

You might also like