// roterr knopf funkionslos wirkungsloss
int rotstatus = 0; // status des roten button
int zaehler = 0;
int LEDblau=6;//
int taster=7;//
int tasterstatus = 0;//
int button = 2; //pin of the first button
int button1 = 3; //pin of the second button ///rechter butto
#include<Servo.h> //include the servo library
Servo servo; //create a servo object
int pos = 0; //initial position of the servo
void setup() {
Serial.begin(9600);///
pinMode(LEDblau, OUTPUT);//
pinMode(taster, INPUT);//
// put your setup code here, to run once:
servo.attach(9); //pin used by the servo
pinMode(button, INPUT_PULLUP); //define first button as input pullup
pinMode(button1, INPUT_PULLUP); //define second button as input pullup
/*
INPUT_PULLUP send to arduino LOW signal, so, when you press the button, you send a LOW signal to arduino
*/
}
//
void loop() {
// Serial.print(" ");
//Serial.print(zaehler );
//zaehler = zaehler + 1;
Serial.print(rotstatus);
Serial.println(digitalRead(button1));
//Serial.print (pos );
//Serial.print(" ");
pos = pos + 1;
tasterstatus=digitalRead(taster);//
//Serial.print(tasterstatus );
if (pos > 400)
{
pos = 0; //ok
tasterstatus = HIGH; //blauelampe leuchtet bei knopfdruck, spätesttens nach 200
//servo.write(90)
}
if (tasterstatus == HIGH ) // HiGH ist 1
{ digitalWrite(LEDblau, HIGH ); //
servo.write(180);
Serial.println ("hoch ");
delay (50); //
servo.write(0);
digitalWrite(LEDblau, LOW );//
//}
//else
//{ digitalWrite(LEDblau, LOW ); // low istt 0
//digitagitalWrite(LEDblau, LOW) ;//
//Serial.print("tief");
//delay (100 ) ;
}
}
/*
// put your main code here, to run repeatedly:
if (digitalRead(taster ) == LOW) { //if Value read of the button ==LOW:
pos++; //increases the value of the "pos" variable each time the push button of the left is pressed
delay(5); //5 milliseconds of delay
servo.write(pos); //servo goes to variable pos
}
if (digitalRead(button1) == LOW) { //if Value read of the button ==LOW:
Serial.print("€€€");
pos == -30 ;// servo(pos ) ;
// pos--; //decreases the value of the "pos" variable each time the push button of the right is pressed
delay(15); //5 milliseconds of delay
servo.write(pos); //servo goes to variable pos
}
}
*/