entries0=111; valmin0=100; valmax0=158;pin0=[
199; 199; 199; 199; 199; 199; 199; 197; 199; 199; 199; 197; 199; 199; 199; 199;
199; 199; 197; 197; 199; 239; 241; 242; 244; 243; 242; 242; 244; 234; 226; 218;
213; 208; 207; 205; 202; 201; 201; 200; 200; 199; 200; 199; 199; 199; 199; 199;
199; 199; 199; 199; 199; 199; 199; 199; 199; 199; 197; 199; 199; 199; 199; 199;
197; 197; 197; 198; 199; 197; 199; 199; 197; 197; 197; 199; 199; 199; 199; 197;
199; 197; 198; 199; 197; 199; 199; 197; 199; 199; 199; 199; 199; 199; 199; 197;
199; 199; 199; 199; 199; 199; 199; 199; 199; 199; 199; 199; 199; 199; 199; 199;
199; 199; 199; 199; 199; 199; 199; 199; 199; 241; 243; 243; 244; 242; 242; 244;
244; 234; 225; 218; 213; 209; 208; 205; 204; 202; 201; 200; 200; 200; 200; 200;
200; 199; 199; 199; 199; 199; 199; 199; 199; 199; 199; 199; 200; 200; 199; 199;
200; 199; 199; 199; 200; 199; 200; 200; 200; 199; 200; 199; 200; 199; 199; 200;
199; 199; 200; 200 ];
close all; disp(''); l=128; alpha=2;
 p=[]; y=-1; for i=1:l;
  if (i<(l-8)/2 || i>=(l+8)/2) x=-1; else x=15; endif;
  y+=(x-y)/alpha; p(i)=y; endfor;
 p=round(p+0.09); res=[alpha l sum(p) sum(p>-1)];
 entries=[entries0]; dumpval=[pin0];
 for f=1
  val=dumpval(:,f); val=shift(val,-mod(entries(f),length(val))); raw=val;
  val=1*round(val/1);
  sintv=2.5; c=arduino(val,p'); res(end+1)=max(c);
  figure(f); [xx yy]=stairs(sintv*(1:length(val)),val);
  [ax h1 h2]=plotyy(xx,yy,sintv*(length(p)/2+(1:length(c))),c)
  set(h1,'linewidth',3);set(h2,'linewidth',3);
  title(sprintf("pin %d",f-1));
 endfor; printf("%d\t%d\t%d\t%d\t%.3f\t%.3f\n",res);
