//quack
#include <Servo.h>
int pos = 0;
int pos2 = 0;
Servo topServo;
Servo bottomServo;
int joystick = A0;
void setup() {
Serial.begin(9600);
pinMode(11, OUTPUT);
pinMode(10, OUTPUT);
topServo.attach(11);
bottomServo.attach(10);
}
void serialTextThingie() {
Serial.print("Joystick: ");
Serial.print(analogRead(A0));
Serial.print(" / Top Servo: ");
Serial.print(topServo.read());
Serial.print(" / Bottom Servo: ");
Serial.print(bottomServo.read());
Serial.print(" / pos: ");
Serial.print(pos);
Serial.print(" / pos2: ");
Serial.println(pos2);
}
void loop() {
if (joystick >= 600) {
for (pos = 180; pos <= 90; pos += 1)
{
topServo.write(pos);
//bottomServo.write(pos2);
delay(5);
serialTextThingie();
}
for (pos = 90; pos >= 180; pos -= 1)
{
topServo.write(pos);
//bottomServo.write(pos2);
delay(5);
serialTextThingie();
}
}
}