sto cercando di gestire 2 servocomndi con due potenziometri , vedendo che i servo non avevano la giusta corrente e arduino si resettava cercando in rete ho capito (spero ) che serviva un DC-DC regolabile step-down di modo da dare 6v al servo . il punto è ,come ho gia postato qua :http://forum.arduino.cc/index.php?topic=474584.new#new i servi tremano e non rispondono ai comandi , tra le prove fatto ieri l'unica cosa che ho notato che i pin A0 e A1 è come se fossero lo stesso pin . spero di avervi fatto capire , portate pazienza ma sono propio alle prime armi con l'elettronica e programmazione .
ecco il codice , l'ho copiato da un post trovato qua sul foro senza toccarlo .
// Controlling a servo position using a potentiometer (variable resistor)
// by Michal Rinott <http://people.interaction-ivrea.it/m.rinott>
#include <Servo.h>
Servo myservo; // create servo object to control a servo
Servo myservo2; // secondo servo
int potpin = 0; // analog pin used to connect the potentiometer
int potpin2 = 1; // secondo potenziometro collegato a A1
int val; // variable to read the value from the analog pin
void setup()
{
myservo.attach(9); // attaches the servo on pin 9 to the servo object
myservo.attach(10); // secondo servo al pin 10
}
void loop()
{
val = analogRead(potpin); // reads the value of the potentiometer (value between 0 and 1023)
val = map(val, 0, 1023, 0, 179); // scale it to use it with the servo (value between 0 and 180)
myservo.write(val); // sets the servo position according to the scaled value
val = analogRead(potpin2); // secondo servo
val = map(val, 0, 1023, 0, 179);
myservo2.write(val);
delay(15); // waits for the servo to get there
}