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)) {
|
|
|
|
linkeAugenbraue.write(90);
|
|
|
|
rechteAugenbraue.write(90);
|
2023-07-19 14:34:25 +02:00
|
|
|
Serial.println("Vorwärts");
|
|
|
|
debug();
|
2023-07-19 14:22:32 +02:00
|
|
|
}
|
|
|
|
if (istTasterGedrueckt(D3)) {
|
|
|
|
linkeAugenbraue.write(0);
|
|
|
|
rechteAugenbraue.write(0);
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
|