V5 Memory Permission Error 03802578

My code is yielding a “memory permission error” across multiple brains both on a wireless and wired connection. I have changed declarations, variables, and tried to decipher if I’m misusing pointers to no avail. I believe the cause is in the DriverControl.h file. Please advise!

Code:

yea, so all this stuff in header files (which should also not have actual code in) is causing your error.

double for_backAxis = Controller1.Axis3.value();
double turnAxis = Controller1.Axis1.value();
int BrakeButton = Controller1.ButtonB.pressing();
double  Left_V = 0, Right_V = 0;
double dir_mult = 1;

int Lift_up = Controller1.ButtonR1.pressing();
int Lift_down = Controller1.ButtonR2.pressing();
const int Lift_Speed = 35;//percentage motor speed

int Intake_in = Controller1.ButtonL1.pressing();
int Intake_out = Controller1.ButtonL2.pressing();

The errors happens because you try and use the instance “Controller1” before it has been created, but also that code makes no sense, why initialize a global variable from the current value of a Controller button or axis ?

In general, the code needs to be reorganized due to incorrect use of header files, keep function definitions should be in .cpp source files, function declarations go in the header files.

4 Likes