2023-07-19 14:22:32 +02:00
|
|
|
/* Sweep
|
|
|
|
by BARRAGAN <http://barraganstudio.com>
|
|
|
|
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.h>
|
|
|
|
|
|
|
|
Servo linkeAugenbraue;
|
|
|
|
Servo rechteAugenbraue; // create servo object to control a servo
|
|
|
|
// twelve servo objects can be created on most boards
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void setup() {
|
2023-07-19 14:34:25 +02:00
|
|
|
rechteAugenbraue.attach(D1);
|
|
|
|
linkeAugenbraue.attach(D4); // attaches the servo on GIO2 to the servo object
|
2023-07-19 14:22:32 +02:00
|
|
|
pinMode(D2, INPUT_PULLUP);
|
|
|
|
pinMode(D3, INPUT_PULLUP);
|
|
|
|
|
|
|
|
Serial.begin(9600);
|
|
|
|
}
|
|
|
|
|
|
|
|
void loop() {
|
|
|
|
if (istTasterGedrueckt(D2)) {
|
2023-07-19 14:43:27 +02:00
|
|
|
for(int i = 0; i<= 90; i++){
|
|
|
|
rechteAugenbraue.write(i);
|
|
|
|
linkeAugenbraue.write(i);
|
|
|
|
}
|
|
|
|
|
2023-07-19 14:34:25 +02:00
|
|
|
Serial.println("Vorwärts");
|
|
|
|
debug();
|
2023-07-19 14:22:32 +02:00
|
|
|
}
|
|
|
|
if (istTasterGedrueckt(D3)) {
|
2023-07-19 14:43:27 +02:00
|
|
|
for(int i = 90; i>= 0; i--){
|
|
|
|
rechteAugenbraue.write(i);
|
|
|
|
linkeAugenbraue.write(i);
|
|
|
|
}
|
2023-07-19 14:34:25 +02:00
|
|
|
Serial.println("Rückwärts");
|
|
|
|
debug();
|
2023-07-19 14:22:32 +02:00
|
|
|
}
|
|
|
|
|
2023-07-19 14:34:25 +02:00
|
|
|
//debug();
|
2023-07-19 14:22:32 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
void debug(){
|
2023-07-19 14:34:25 +02:00
|
|
|
Serial.write("Spannung auf linker Augenbraue: ");
|
|
|
|
Serial.println(D4);
|
|
|
|
Serial.write("Spannung auf rechter Augenbraue: ");
|
|
|
|
Serial.println(D1);
|
2023-07-19 14:22:32 +02:00
|
|
|
delay(200);
|
|
|
|
}
|
|
|
|
bool istTasterGedrueckt(int taster) {
|
|
|
|
return digitalRead(taster) == LOW;
|
|
|
|
}
|
|
|
|
|
|
|
|
|