- #include <Servo.h>
- Servo servo;
- int tlacitko = D6;
- void setup() {
- pinMode(tlacitko, INPUT_PULLUP);
- servo.attach(2); //D4
- servo.write(0);
- delay(2000);
-
- }
-
- void loop() {
- int energie = digitalRead(tlacitko);
- if(energie == false)
- {
- delay(1000);
- servo.write(90);
- delay(10000);
- servo.write(0);
- }
-
- }
|