close all
clear all

%ports = instrfind('Port','COM5');
%instrreset();

I_Mean = 0.5; %Amps
I_Amp = 0.5;  %Amps

T = 15;  %seconds

sp = serial('COM8', 'BaudRate', 38400);
fopen(sp);

BK_EnableRemote(sp,1);
BK_SetCCMode(sp);
BK_LoadOn(sp,1)



starttime = now;

while(1)
    t = datenum(now-starttime)*24*3600
    I = I_Mean+I_Amp*cos(2*pi*t/T);
    BK_SetCurrent(sp,I);
    pause(.1);
end
