микро серво 9г страна работает

garmoska89
Offline
Зарегистрирован: 20.12.2011

 http://www.ebay.com/itm/F00101-SG-90-SG90-9g-Servo-FOR-RC-Helicopter-Plane-Boat-Car-/130625445870?pt=Radio_Control_Parts_Accessories&hash=item1e69e21fee#ht_4339wt_1139

там 3 контакты
red-5V
black-GND and
White - data типа на белыи 0В-5В зависит от тока.

#include <Servo.h>
Servo sergiu;
int servoPin =9;
void setup()
{
sergiu.attach(servoPin);
Serial.begin(9600);
}
void loop()
{

for (int i=0;i <=180;i=i+20)
{
sergiu.write(i);
delay(1000);
Serial.println(i);
}
}
должно работать он питается от ардуино вроде не употребляет многа

помогите пожалуста

Alexander
Offline
Зарегистрирован: 25.04.2010
garmoska89
Offline
Зарегистрирован: 20.12.2011

 

// Sweep
// by BARRAGAN <http://barraganstudio.com> 
// This example code is in the public domain.


#include <Servo.h> 
 
Servo myservo;  // create servo object to control a servo 
                // a maximum of eight servo objects can be created 
 
int pos = 0;    // variable to store the servo position 
 
void setup() 
{ 
  myservo.attach(9);  // attaches the servo on pin 9 to the servo object 
} 
 
 
void loop() 
{ 
  for(pos = 1; pos < 90; pos += 1)  // goes from 0 degrees to 180 degrees 
  {                                  // in steps of 1 degree 
    myservo.write(pos);              // tell servo to go to position in variable 'pos' 
    delay(15);                       // waits 15ms for the servo to reach the position 
  } 
  for(pos = 90; pos>=1; pos-=1)     // goes from 180 degrees to 0 degrees 
  {                                
    myservo.write(pos);              // tell servo to go to position in variable 'pos' 
    delay(15);                       // waits 15ms for the servo to reach the position 
  } 
} 

 

garmoska89
Offline
Зарегистрирован: 20.12.2011
// Sweep
// by BARRAGAN <http://barraganstudio.com> 
// This example code is in the public domain.


#include <Servo.h> 
 
Servo myservo;  // create servo object to control a servo 
                // a maximum of eight servo objects can be created 
 
int pos=0;    // variable to store the servo position 
 
void setup() 
{ 
  myservo.attach(9);  // attaches the servo on pin 9 to the servo object 
Serial.begin(9600);
myservo.write(pos);
} 
 
 
void loop() 
{ 
while (Serial.available()==0);
{pos=Serial.read()-'0';
pos=pos*10;
Serial.println(pos);
myservo.write(pos);
delay(100);
}
} 

 

garmoska89
Offline
Зарегистрирован: 20.12.2011

 на 1 3 4 5  работает нрм

на 8 или 9 гуляет туда сюда

Poluekt
Offline
Зарегистрирован: 14.11.2011

Ошибся :((