I have this code, it is giving me errors at 10,10 or the #include “vex.h” (Just has a X and then(10, 10)B But this is automatically included, what should I do to fix this?
Thanks!
// Make sure all required headers are included.
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <math.h>
#include <string.h>
#include "vex.h"
using namespace vex;
// Brain should be defined by default
brain Brain;
// START IQ MACROS
#define waitUntil(condition) \
do { \
wait(5, msec); \
} while (!(condition))
#define repeat(iterations) \
for (int iterator = 0; iterator < iterations; iterator++)
// END IQ MACROS
// Robot configuration code.
controller Controller = controller();
motor Left = motor(PORT1, false);
motor Top = motor(PORT3, false);
motor Right = motor(PORT6, false);
motor Bottom = motor(PORT9, false);
// define variable for remote controller enable/disable
bool RemoteControlCodeEnabled = true;
#pragma endregion VEXcode Generated Robot Configuration
//----------------------------------------------------------------------------
//
// Module: main.cpp
// Author: <redacted>
// Created: 4/26/22
// Description: Code For The X-Drive
// Last Updated: 2/26/22
//
//----------------------------------------------------------------------------
// Include the IQ Library
#include "iq_cpp.h"
// Allows for easier use of the VEX Library
using namespace vex;
//Setting 1 Is include Display (worse performance) , Setting 0 is Do not include (Better performance)
void Int(Setting) {
if (setting == 1) {
Top.setVelocity(0, percent)
Right.setVelocity(0, percent)
Left.setVelocity(0, percent)
Bottom.setVelocity(0, percent)
Top.setMaxTorque(100, percent)
Right.setMaxTorque(100, percent)
Left.setMaxTorque(100, percent)
Bottom.setMaxTorque(100, percent)
Top.setTimeout(1, seconds)
Right.setTimeout(1, seconds)
Left.setTimeout(1, seconds)
Bottom.setTimeout(1, seconds)
Top.spin(forward)
Right.spin(forward)
Left.spin(forward)
Bottom.spin(forward)
while (true) {
Brain.Screen.setCursor(1, 1);
Brain.Screen.print("Driving? %s", Top.isDone() ? "Yes" : "No");
Brain.Screen.print("%d", Brain.Battery.capacity(percent));
wait(1, seconds)
Brain.Screen.clearScreen()
}
}
if (setting == 0) {
Top.setVelocity(0, percent)
Right.setVelocity(0, percent)
Left.setVelocity(0, percent)
Bottom.setVelocity(0, percent)
Top.setMaxTorque(100, percent)
Right.setMaxTorque(100, percent)
Left.setMaxTorque(100, percent)
Bottom.setMaxTorque(100, percent)
Top.setTimeout(1, seconds)
Right.setTimeout(1, seconds)
Left.setTimeout(1, seconds)
Bottom.setTimeout(1, seconds)
Top.spin(forward)
Right.spin(forward)
Left.spin(forward)
Bottom.spin(forward)
}
}
void turnn() {
while (Controller.AxisD.changed()) {
Top.setVelocity(Controller.AxisD.position())
Right.setVelocity(Controller.AxisD.position())
Left.setVelocity(Controller.AxisD.position())
Bottom.setVelocity(Controller.AxisD.position())
}
thread turnn = thread(turnn)
}
void movement() {
while (true) {
Top.setVelocity(Controller.AxisA.position()())
Right.setVelocity(Controller.AxisA.position())
Left.setVelocity(Controller.AxisA.position() * -1)
Bottom.setVelocity(Controller.AxisA.position() * -1)
if Controller.AxisD.changed() {
thread turnn = thread(turnn)
break;
}
}
}
int main() {
thread Int = thread(Int(1))
wait(1, seconds)
thread movement = thread(movement)
}
Thanks,
Do you know why these did not show up? When I used to code in VS it would show all of them even if it had an error before. Is this something with Vex code?