entries0=1328; valmin0=100; valmax0=158;pin0=[
104;	107;	107;	105;	104;	106;	107;	105;	105;	106
107;	107;	107;	106;	105;	105;	107;	106;	105;	107
105;	104;	105;	106;	105;	104;	106;	106;	105;	104
105;	106;	105;	104;	105;	107;	105;	104;	105;	106
105;	104;	106;	107;	105;	104;	105;	107;	105;	104
105;	107;	105;	104;	105;	106;	105;	104;	106;	107
105;	104;	104;	105;	106;	106;	106;	104;	104;	107
106;	104;	104;	107;	106;	104;	105;	107;	106;	104
105;	106;	106;	104;	104;	107;	106;	104;	104;	106
106;	104;	105;	107;	106;	104;	104;	107;	105;	104
104;	107;	106;	104;	104;	106;	106;	104;	104;	107
106;	103;	104;	106;	105;	104;	104;	107;	106;	104
104;	106;	106;	104;	104;	107;	106;	104;	104;	106
105;	104;	105;	106;	106;	104;	104;	106;	106;	104
104;	107;	106;	104;	105;	135;	143;	149;	152;	156
157;	158;	158;	145;	138;	129;	126;	124;	122;	118
116;	117;	115;	112;	112;	113;	112;	112;	111;	110
110;	111;	112;	109;	108;	110;	111;	108;	107;	109
110;	107;	107;	109;	109;	107;	106;	108;	108;	106
106;	108;	108;	106;	105;	108;	108;	106;	105;	108
108;	105;	105;	107;	108;	106;	105;	107;	108;	105
105;	107;	108;	105;	105;	107;	108;	105;	105;	107
107;	106;	105;	107;	108;	105;	105;	107;	107;	105
105;	107;	107;	105;	104;	107;	107;	105;	105;	107
108;	105;	104;	106;	107;	105;	105;	107;	107;	105
104;	107;	107;	105;	105;	106;	107;	105;	104;	106
107;	105;	];
entries1=2983; valmin1=92; valmax1=175;pin1=[
94;	98;	105;	100;	94;	98;	105;	100;	94;	100
103;	105;	106;	105;	99;	94;	100;	105;	98;	96
102;	104;	97;	96;	103;	104;	97;	97;	104;	106
99;	94;	101;	105;	99;	96;	102;	105;	98;	96
103;	104;	97;	97;	104;	104;	96;	95;	100;	106
99;	96;	102;	105;	99;	96;	103;	105;	98;	97
104;	104;	97;	95;	100;	106;	100;	96;	102;	106
99;	96;	102;	105;	98;	97;	104;	104;	97;	97
104;	106;	100;	96;	102;	106;	99;	96;	102;	105
99;	96;	103;	105;	97;	96;	104;	104;	100;	96
102;	102;	107;	99;	94;	102;	107;	98;	95;	103
107;	97;	94;	104;	106;	96;	95;	102;	107;	99
94;	102;	107;	98;	95;	103;	107;	97;	94;	104
106;	97;	95;	101;	107;	99;	94;	102;	107;	99
95;	103;	107;	97;	94;	103;	106;	97;	95;	104
107;	100;	94;	102;	107;	99;	95;	103;	107;	98
94;	103;	107;	97;	95;	104;	106;	103;	100;	97
96;	97;	105;	103;	96;	99;	106;	102;	95;	99
106;	101;	95;	100;	107;	100;	94;	97;	104;	103
96;	99;	105;	102;	96;	99;	106;	102;	95;	100
107;	100;	95;	101;	104;	103;	96;	98;	105;	103
96;	99;	105;	102;	96;	100;	106;	101;	95;	100
106;	104;	97;	98;	105;	103;	96;	154;	172;	173
172;	173;	175;	172;	171;	141;	116;	101;	96;	96
103;	100;	92;	95;	102;	99;	92;	96;	103;	99
92;	97;	104;	98;	92;	96;	103;	102;	94;	96
103;	97;	];
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,entries1]; dumpval=[pin0,pin1];
 for f=1:2
  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);
