 	}
 }
 
-int readFrame(int cyclecount0, int cyclecount1)
+byte readFrame(unsigned int cyclecount0, unsigned int cyclecount1)
 {
 	if (cyclecount0 < cyclecount1) {
 		if (cyclecount1 < 2 * cyclecount0)

	pinMode(BRX, INPUT);
	servo.attach(SRV);
	Serial.begin(9600);
}

byte bytebitsGet() {

	return ERROR; // never reach
}

byte getFrame(int pin)
{
	unsigned int cyclecount1=0;
	unsigned int cyclecount0=0;
	while (digitalRead(pin) == HIGH) {
		cyclecount1 = cyclecount1 + 1;
	}
	while (digitalRead(pin) == LOW) {
		cyclecount0 = cyclecount0 + 1;
		if (cyclecount0 == NOFRAME_TRESHOLD)
			return NOFRAME;
	}
	return readFrame(cyclecount0, cyclecount1);
}

void sendBytebits()
{
	byte i=8;
	while (i) {
		if (bytebits[--i])
			send1(BTX, sleepms);
