This is just the PWM code I am not using the LEM Sensor at all here

My thoughts are that I am going to have to hook up the lem sensor and just run the car up to about 100 amps on jack stands see what measurements I get when I reach 100 amps. Let's say its a digital value of 150 on the print line that means if I were consuming 500 amps then the digital value would be 750. So if I wanted to limit to 500 then I would decrease the PWM High every time the sensor read that value just a little enough to keep me under 500 amps. I wonder how to know just how much to decrease the throttle so that it limits it just the right amount? and if I do so will there be any herky jerkiness of the throttle. Under normal driving the car barely ever reached 250 amps but the initial amperage is much higher maybe I just need some soft start code for when I just take off. I have a few of ideas I just don't know how to put them into the code.
From what I can tell on the print line the LEM is linear. The -28 is for the calibration of the pot.
Why wouldn't I need to create PWM on off times is it because somewhere in there library they have this code or something like it written because if they do I have looked all through it and didn't see anything like this to control a motor which is odd because every other micro controller that uses basic already has a library with a code for pwm for a motor
My thoughts are that I am going to have to hook up the lem sensor and just run the car up to about 100 amps on jack stands see what measurements I get when I reach 100 amps. Let's say its a digital value of 150 on the print line that means if I were consuming 500 amps then the digital value would be 750. So if I wanted to limit to 500 then I would decrease the PWM High every time the sensor read that value just a little enough to keep me under 500 amps. I wonder how to know just how much to decrease the throttle so that it limits it just the right amount? and if I do so will there be any herky jerkiness of the throttle. Under normal driving the car barely ever reached 250 amps but the initial amperage is much higher maybe I just need some soft start code for when I just take off. I have a few of ideas I just don't know how to put them into the code.