is it possible to power both apm and servos with a USB cable? I mean by connecting the apm board to the computer? I tried to control the servo but it seems like it doesn't work. Is it because of the lack of power supply by the USB? The followings are the code that i found on the web to control the servo.
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(8); // attaches the servo on pin 8 to the servo object
}
void loop()
{
for(pos = 0; pos < 180; 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 = 180; 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
}
}
Tags:

No it is not possible to power the servos via USB. The USB specification only provides about 1.5 Amp @ 5 V which would be quickly cause a overload on the host computer when multiple servos are moving.
Season Two of the Trust Time Trial (T3) Contest has now begun. The fourth round is an accuracy round for multicopters, which requires contestants to fly a cube. The deadline is April 14th.51 members
87 members
24 members
683 members
184 members
© 2013 Created by Chris Anderson.
Powered by
