So I’m a C++ beginner, and I’m just starting to understand some concepts. In order to try to understand how pointers work, I “theorized” (made it up to see if it would work) this:
controller *Controller;
void usercontrol(void) {
// User control code here, inside the loop
while (1) {
// This is the main execution loop for the user control program.
// Each time through the loop your program should update motor + servo
// values based on feedback from the joysticks.
float throttle = Controller -> Axis3.value();
float turn = Controller -> Axis4.value(); //single stick drive
float lpct = throttle + turn;
float rpct = throttle - turn;
L.spin(fwd, (lpct), pct);
R.spin(fwd, (rpct), pct);
// ........................................................................
// Insert user code here. This is where you use the joystick values to
// update your motors, etc.
// ........................................................................
wait(20, msec); // Sleep the task for a short amount of time to
// prevent wasted resources.
}
}
Would this (theoretically) work? If so, what differences would there be from normal usage? I’m not going to use this (and nobody should) but I’m just curious to see if it would work.
(mods, I made an error in my original post, so I’m reposting with the correct code)