close all
clear all
clear globals; 

p = PID_Shim; p.Configure;


It = .75;  %Amps

SIt = .5*It/15+.25
if(SIt > .75) SIt = .75;  end
if(SIt < .25) SIt = .25;  end
p.Set_PWM_DutyCycle(SIt);
  
tic;
while(1)
 t = toc;
 
  It = .75+.5*sin(2*pi*t/10);
  SIt = .5*It/15+.25
  if(SIt > .75) SIt = .75;  end
  if(SIt < .25) SIt = .25;  end
  p.Set_PWM_DutyCycle(SIt);
 
 [err Ic] = p.GetADC(1);
 [err Ir] = p.GetADC(0);

 Ic = (Ic-.505)/.18;
 Ir = (Ir-.332)/.12;
 
 disp(['It = ' num2str(It) '   Ic = ' num2str(Ic)   '   Ir = ' num2str(Ir)]);
 
end