How to write PID code

So I’m working on PID and I have all the functions down, but I’m trying to figure out how to make the code run. Here is a sample of my code

void autonomous(void) {
//turn on the PID
vex::task WhateverSomethingRandom(driverPID);

//move the back lift down and then back up
HeroLift.spin(forward, 100, pct);
wait(1.2, seconds);
HeroLift.spin(reverse, 100, pct);
wait(1.1, seconds);

//turn to the right
resetDriveSensors = true;
DesiredTurnValue = 180;

//move forward 36 inches
resetDriveSensors = true;
DesiredValue = 2057;

I’m just checking to see if this is how I make my motors actually turn the way I want them too or if I have to write it in a different way. If you can help please just respond to this. (All of these values are in degrees)

Please use code tags.

Put ```, and on the next lines, your code, and after the last line of code, three more back ticks. (They’re above the tab key.)

I would not suggest this. I would suggest

void turn(double angle) {
  DesiredTurnValue += angle;
  for (int i = 0; i < 10; i++) {
    waitUntil(/*gyro reading or whatever is within acceptable error margin*/)

That way your waits are exactly the length they have to be. I guess some people do it the way you are, though, so I suppose it works. Take your pick.