/* Sweep by BARRAGAN This example code is in the public domain. modified 28 May 2015 by Michael C. Miller modified 8 Nov 2013 by Scott Fitzgerald http://arduino.cc/en/Tutorial/Sweep */ #include Servo linkeAugenbraue; Servo rechteAugenbraue; // create servo object to control a servo // twelve servo objects can be created on most boards void setup() { rechteAugenbraue.attach(D1); linkeAugenbraue.attach(D4); // attaches the servo on GIO2 to the servo object pinMode(D2, INPUT_PULLUP); pinMode(D3, INPUT_PULLUP); Serial.begin(9600); } void loop() { if (istTasterGedrueckt(D2)) { for(int i = 0; i<= 90; i++){ rechteAugenbraue.write(i); linkeAugenbraue.write(i); } Serial.println("Vorwärts"); debug(); } if (istTasterGedrueckt(D3)) { for(int i = 90; i>= 0; i--){ rechteAugenbraue.write(i); linkeAugenbraue.write(i); } Serial.println("Rückwärts"); debug(); } //debug(); } void debug(){ Serial.write("Spannung auf linker Augenbraue: "); Serial.println(D4); Serial.write("Spannung auf rechter Augenbraue: "); Serial.println(D1); delay(200); } bool istTasterGedrueckt(int taster) { return digitalRead(taster) == LOW; }