#include<Servo.h>
#include <Stepper.h>
Servo FS90;
byte FS90Pin = 9;
byte servoPin = A0;
byte basePin = A1;
byte epaulePin = A2;
byte brasPin = A3;
int servo;
int base;
int epaule;
int bras;
const int stepsPerRevolution = 200; // change this to fit the number of steps per revolution
// for your motor
// initialize the stepper library on pins 8 through 11:
Stepper myStepper(stepsPerRevolution, 11, 13, 12, 10);
int stepCount = 0; // number of steps the motor has taken
void setup() {
FS90.attach(FS90Pin, 500, 2500);
Serial.begin(9600);
}
void loop() {
servo = analogRead(A0);
servo = map(servo, 0, 1023, 0, 180); //ou Servo = Servo*0.176
base = analogRead(A1);
base = map(base, 0, 1023, -100, 100);
myStepper.setSpeed(abs(base));
if (base>0) {
myStepper.step(stepsPerRevolution/10);
}
else if ((base<0)){
myStepper.step(-stepsPerRevolution/10);
}
else{
}
Serial.println("servo= base= ");
Serial.print(servo);
Serial.print(" ");
Serial.println(base);
FS90.write(servo);
//delay(100);
}