//PTP {A1 45, A2 30, A3 0, A4 90, A5 -45, A6 180}
/* Sweep
by BARRAGAN <http://barraganstudio.com>
This example code is in the public domain.
modified 8 Nov 2013
by Scott Fitzgerald
http://www.arduino.cc/en/Tutorial/Sweep
*/
#include <Servo.h>
Servo myservo1;
Servo myservo2;
Servo myservo3;
// create servo object to control a servo
// twelve servo objects can be created on most boards
int pos = 0; // variable to store the servo position
int vlezMot = 0;
int vlez = 0;
void setup() {
myservo1.attach(9); // attaches the servo on pin 9 to the servo object
myservo2.attach(10);
myservo3.attach(11);
Serial.begin(9600);
Serial.println("Серво мотор контролиран со влез од тастатура");
Serial.println("-------------------------------");
}
void loop() {
while (Serial.available() > 1) { // Чека внесување на број
vlez = Serial.parseInt(); // Се парсира
Serial.print("Позиција=");
Serial.println(vlez);
}
myservo1.write(vlez/2); // tell servo to go to position in variable 'pos'
myservo2.write(vlez);
myservo3.write(vlez*2);
delay(15); // waits 15ms for the servo to reach the position
}