Hallo

Meinen Langbein steure ich mit einem Attiny13 und programmiere ihn in C. Der tiny13 kostet ca. 1.15€, hat 8 Pins und steuert bei mir 5 Servos. Mein aktueller Code:
Code:
#include <avr/io.h>
#include <avr/interrupt.h>

//#define f_cpu 9,6 MHz

uint8_t a, b, x, x2, y, y2, z, demo;
volatile uint16_t count, time;

void delay(uint16_t d)                                // Warteschleife
{
	d+=time; while(d>time);
}

ISR(TIM0_COMPA_vect)                                  // Servoansteuerung
{
	if (count>z) PORTB &= ~(1<<PB0); else PORTB |= (1<<PB0);
	if (count>y) PORTB &= ~(1<<PB1); else PORTB |= (1<<PB1);
	if (count>x) PORTB &= ~(1<<PB2); else PORTB |= (1<<PB2);
	if (count>y2) PORTB &= ~(1<<PB3); else PORTB |= (1<<PB3);
	if (count>x2) PORTB &= ~(1<<PB4); else PORTB |= (1<<PB4);
	if (count < 1000) count++; else { count=0; time++; }
}

int main(void)
{
	y=y2=60;
	x=x2=60;
	z=95;
	time=0;

	DDRB = (1<<PB4)|(1<<PB3)|(1<<PB2)|(1<<PB1)|(1<<PB0); // Servoausgänge
	//PORTB= (1<<PB3);                                   // PullUp Taster ein

	TCCR0A =  (0 << WGM00) | (1 << WGM01);					// CTC-Mode
	TCCR0A |= (0 << COM0A0) | (0 << COM0A1);				// ohne OCR-Pin
	TCCR0B = (0 << CS02)  | (0 << CS01) | (1 << CS00);	// prescaler /8
	TIMSK0 =  (1 << OCIE0A); 									// Interrupt ein
	OCR0A  = 11;  // nicht wissenschaftliche Frequenz(100kHz?)
	sei();

	delay(100);
 	{
		for(a=0; a<10; a++) {x++; y++; delay(5);};
		for(a=0; a<10; a++) {y--; delay(5);};
		for(a=0; a<10; a++) {x--; x2--; delay(5);};
 	}
while(1);
	return(0);
}
Nur als Anregung, x,x2,y,y2,z sind die jeweiligen Servopositionen. Wertebereich vom -90° bis + 90° ist ca. 50-150. Vielleicht hilft/inspiriert dich das. Bei Problemen bei der Anpassung an 4-bit-Positionen kannst du gerne nachfragen.

Gruß

mic