Arduino IDE Code
#include <Servo.h>
Servo servo_pin_11;
int zeit = 0 ;
int wiederhole = 0 ;
int fertig = 0 ;
int a;
void setup()
{
servo_pin_11.attach(11);
Serial.begin(9600);
pinMode( 10 , OUTPUT);
pinMode( 6 , OUTPUT);
servo_pin_11.write( 35 );
zeit = 0 ;
wiederhole = 5 ;
fertig = 40 ;
}
void loop()
{
Serial.print("programm start");
Serial.println();
servo_pin_11.attach(11);
digitalWrite( 10 , HIGH );
digitalWrite( 6 , LOW );
delay( 1000 );
servo_pin_11.write( 35 );
delay( 1000 );
servo_pin_11.detach();
Serial.print("poti auslesen");
Serial.println();
zeit = map ( analogRead(4) , 0 , 1023 , 0 , 30000 ) ;
for (a=1; a<= ( wiederhole ); ++a )
{
Serial.print("1 nach");
Serial.print(zeit);
Serial.println();
delay( zeit );
}
servo_pin_11.attach(11);
delay( 100 );
for (a=1; a<= ( 3 ); ++a )
{
Serial.print("ruetteln eins");
Serial.println();
servo_pin_11.write( 40 );
delay( 300 );
servo_pin_11.write( 30 );
delay( 300 );
}
servo_pin_11.detach();
for (a=1; a<= ( wiederhole ); ++a )
{
Serial.print("2 nach");
Serial.print(zeit);
Serial.println();
delay( zeit );
}
servo_pin_11.attach(11);
delay( 100 );
for (a=1; a<= ( 3 ); ++a )
{
Serial.print("rueteln zwei");
Serial.println();
servo_pin_11.write( 40 );
delay( 300 );
servo_pin_11.write( 30 );
delay( 300 );
}
servo_pin_11.detach();
for (a=1; a<= ( wiederhole ); ++a )
{
Serial.print("3 nach");
Serial.print(zeit);
Serial.println();
delay( zeit );
}
servo_pin_11.attach(11);
delay( 100 );
for (a=1; a<= ( 3 ); ++a )
{
Serial.print("rueteln drei");
Serial.println();
servo_pin_11.write( 40 );
delay( 300 );
servo_pin_11.write( 30 );
delay( 300 );
}
servo_pin_11.detach();
for (a=1; a<= ( wiederhole ); ++a )
{
Serial.print("4 nach");
Serial.print(zeit);
Serial.println();
delay( zeit );
}
servo_pin_11.attach(11);
delay( 100 );
Serial.print("Servo Endposition");
Serial.println();
for (a=1; a<= ( 44 ); ++a )
{
fertig = ( fertig + 1 ) ;
servo_pin_11.write( fertig );
delay( 30 );
}
servo_pin_11.write( 85 );
delay( 1000 );
Serial.print("summer start");
Serial.println();
servo_pin_11.detach();
digitalWrite( 6 , HIGH );
delay( 2000 );
digitalWrite( 6 , LOW );
delay( 3000 );
Serial.print("blink start");
Serial.println();
for (a=1; a<= ( 500 ); ++a )
{
Serial.print("blinken 500");
Serial.println();
digitalWrite( 10 , LOW );
delay( 2000 );
digitalWrite( 10 , HIGH );
delay( 300 );
}
}