I am trying to get the following servo-sweep sketch to work on an A-Star 32U4:
http://www.oomlout.com/oom.php/products/ardx/circ-04
(For those not wanting to click the link):
// Sweep
// by BARRAGAN
#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 = 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
}
}
The sketch runs fine on an Arduino Uno.
The sketch will load to the A-Star but when the servo and power are connected the device disappears from the device manager (Win7 Pro) and the servo arm moves back and forth quickly (sort of like a vibration) over a very small range.
The same behavior occurs with Ubuntu, i.e. servo vibration and the device disappearing from the /dev directory.
The same things occur with a second A-Star that I have.
The devices reappear in both Win7 and Ubuntu when power or the servo’s signal wire is disconnected.
I’ve also tried modifying Servo.h (timer1 to timer3) to no avail. I only did this in Win7.
The servo’s signal wire is connected to the upper left pin (9) (next to the usb) and the ground and 5V power are supplied respectively by the second and third pins from the bottom on the right side of the A-Star.
Blink runs fine on both A-Stars.
Thank you in advance.