PID Help and Understanding

Does anyone want to help me with PID. What is it?

PID is a control loop for achieving and maintaining a precise state.

So just to get you started here is some of my old posts trying to explain it.

So a P controller is really what you need most of the time. P stands for proportional.
My favorite explanation is
motor =kp*(where I want to be -where I am) If your very far away from the goal you apply full power while if your very close you apply only a little bit of power.
kP is just a unit conversion like feet to inches. It converts sensor values to motor values. The official method for finding the unit conversion is really just starting at 0 and making it bigger until it works.

This applied to raising an arm could be something like

Here is my favorite guide for an in depth understanding of all of PID. Written by one of the forum members here.

Could anyone help me with writing a PID program

That guide is pretty much giving you a PID program albeit in pseudocode…

If you’re going to use it on your flywheel, make sure that you calculate the velocity with an quad encoder or IME.