//neni pouzito, jen zalohovana asi mereni infra diody

/*short pmereni,pcmer;
for(pcmer=0;pcmer<CITLIVOST;pcmer++)
for(pmereni=0;pmereni<MERENI;pmereni++) 
hodn[pcmer][pmereni]=0;
*/

/*
#define ROZPTYL 16
#define MEZ1 8
#define MERENI 64
#define CITLIVOST 3
short hodn[CITLIVOST][MERENI];
short pozice=0,c=0;

short hodnmeze(short i)
{if(i>=MERENI) i=i-MERENI;return hodn[c][i];}

short druhej_filtr(){
int filtr=0;
int f;
for(f=pozice;f<pozice+MERENI;f++) filtr+=hodnmeze(f);
return filtr/MERENI;};

short mereni()
{short f,max=0,min=255,h;
int filtr=0;

		ADMUX|=_BV(MUX0);
		ADCSRA|=_BV(ADSC);
		while(ADCSRA&_BV(ADSC)){}
		hodn[c][pozice]=ADCH;
//return hodn[c][pozice];//bez filtru
for(f=pozice;f<pozice+MEZ1;f++){
h=hodnmeze(f);
if(h>max)max=h;
if(h<min)min=h;
filtr+=h;
}
//USART_Transmit(max-min);
//USART_Transmit(min);
//USART_Transmit(hodn[c][pozice]);
if((max-min)>ROZPTYL) return druhej_filtr();
else 
return filtr/MEZ1;
}
*/
/*   mereni infra diody
if(TIFR&_BV(TOV0))
{TIFR|=_BV(TOV0);
if(pozice==0)pozice=MERENI+1;
pozice--;
c=0;OCR1A=27;_delay_us(100);USART_Transmit(mereni());
c=1;OCR1A=28;_delay_us(100);USART_Transmit(mereni());
c=2;OCR1A=30;_delay_us(100);USART_Transmit(mereni());
if(TIFR&_BV(TOV0)){
USART_Transmit(0);
}else
USART_Transmit(TCNT0);
}
*/

/*
		ADMUX&=~_BV(MUX0);
		ADCSRA|=_BV(ADSC);
		while(ADCSRA&_BV(ADSC)){}
		//OCR1AL=ADCH;
//	USART_Transmit(ADCL);
		pot=ADCH;
*/	
	
		
	
	//if(presc>=10)
	
		
/*	{presc=0;
		USART_Transmit(pot);
		USART_Transmit(Vpwm);
		USART_Transmit(OCR1AL);		
		USART_Transmit(VI/256+128);
	}	
	presc++;
*/	

//regulace();
		


//*/




/*  ovladani serva 
DDRB|=_BV(PIN2);
while(1){
int i;
for(i=0;i<50;i++){
_delay_us(19900);
PORTB|=_BV(PIN2);
_delay_us(100);
PORTB&=~_BV(PIN2);}
for(i=0;i<50;i++){
_delay_us(15500);
PORTB|=_BV(PIN2);
_delay_us(4500);
PORTB&=~_BV(PIN2);
}
}
*/
