Hello, I am a high school student currently working on a project where my partner and I are coding and attaching a robotic arm to a wheelchair and coding it to help medically disabled people perform normal tasks. I am running into issues where the servo motors I am using (recommended by RobotShop) are not responding to the code that I am uploading.
Here is the code that I am trying to upload.
#include <Wire.h>
#include <Adafruit_PWMServoDriver.h>
int baseServoPosition = 0;
int shoulderServoPosition = 0;
int elbowServoPosition = 0;
int wristServoPosition = 0;
int gripperServoPosition = 0;
// called this way, it uses the default address 0x40
Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver();
// you can also call it with a different address you want
//Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver(0x41);
void setup()
{
pwm.begin();
pwm.setPWMFreq(60); // Analog servos run at ~60 Hz updates
}
void loop()
{
grabbingBrush();
}
void grabbingBrush()
{
for(int pulseLength = 0; pulseLength < 100; pulseLength++)//rotate towards the brush
{
pwm.setPWM(0,0,pulseLength);
}
delay(5000);
for(int pulseLength1 = 0; pulseLength1 < 100; pulseLength1++)//bring the arm down
{
pwm.setPWM(1,0,pulseLength1);
}
delay(5000);
for(int pulseLength2 = 0; pulseLength2 < 100; pulseLength2++)//bring the arm down
{
pwm.setPWM(2,0,pulseLength2);
}
delay(5000);
for(int pulseLength3 = 0; pulseLength3 < 100; pulseLength3++) //need confirmation on number in middle
{
pwm.setPWM(3,0,pulseLength3);
}
delay(5000);
for(int pulseLength4 = 0; pulseLength4 < 100; pulseLength4++)
{
pwm.setPWM(4,0,pulseLength4);
}
delay(10000);
}
I am adapted and changed the tutorial code found at the AdaFruit website to make this program. Thank you for any help that anyone can give!
Links:
http://www.robotshop.com/en/lynxmotion-al5d-robot-arm-hardware-4dof.html <— Robotic arm from Robotshop
http://arduino.cc/en/Main/ArduinoBoardUno <— Arduino Board
http://www.adafruit.com/products/1411 <— Shield that I am using.