Show Posts
Pages: [1] 2
1  Topics / Robotics / Re: Sweep Servo Sketch on: October 18, 2012, 08:28:55 am
Many thanks, I've spent ages getting it wrong!
2  Topics / Robotics / Sweep Servo Sketch on: October 18, 2012, 07:49:05 am
How can I change this code to get the servos moving in opposite directions at the same time?

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


#include <Servo.h>

Servo myservo1;  // create servo object to control a servo
Servo myservo2;  // a maximum of eight servo objects can be created

int pos = 0;    // variable to store the servo position

void setup()

  myservo1.attach(9);   // attaches the servo on pin 9 to the servo object
  myservo2.attach(10);  // attaches the servo on pin 10 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
    myservo1.write(pos);
    myservo2.write(pos);             
    delay(15);                       
  } 
  for(pos = 180; pos>=1; pos-=1)     // goes from 180 degrees to 0 degrees
  {                                
    myservo1.write(pos);
    myservo2.write(pos);   
    delay(15);                   
  } 


3  Topics / Robotics / Re: HiTech Servo - How to connect something to it? (Screw size) on: October 18, 2012, 07:47:11 am
I usually drill the holes out to 1.6mm and then run an M2 tap through the hole. You can then use any M2 machine screw.

Or

drill 2.5mm hole and tap with an M3 tap

RS Components have a large range or taps
4  Topics / Robotics / Re: Ramp up'/Soft start from power up on: October 17, 2012, 04:48:20 am
I tried a variation of what I already had and also something similar to the sweep command from the library.
Both worked at the setup point but at 'power on' there was still a jump.

I guess I need something that will dial up the power to the servos or use an encoder.
I think I'll leave it this time and look into it at a later date.

Thanks for the advice
5  Topics / Robotics / Re: Ramp up'/Soft start from power up on: October 16, 2012, 01:48:36 pm
The adding code to the setup part of the sketch didn't work and I figured that it may need more hardware.
Many thanks for the advice
6  Topics / Robotics / Re: Ramp up'/Soft start from power up on: October 16, 2012, 09:54:33 am
For some reason I thought the {} were needed, but obviously not!

I'm a real beginner at all this as you can tell.

I'll try using code from the 'sweep' sketch example I found in the library. Would that, or something like it, be the way to go?
7  Topics / Robotics / Ramp up'/Soft start from power up on: October 16, 2012, 02:30:36 am
I am using the 'VarSpeedServo' library, which is fantastic and I believe was contributed by 'Korman'.

My question; is there a way to soft start the servos, i,e, get them to move to their start position from power up without jumping at full speed?

Can it be done through the Arduino or can it be done with electronics?

Quote
#include <VarSpeedServo.h>


const int mainPin1 = 3;
const int mainPin2 = 5;          
const int mainPin3 = 10;
const int mainPin4 = 11;
const int ServoMin = 850;   // Minimum pulse width for servos in ms.
const int ServoMax = 2100;   // Maximum pulse width for servos in ms.

int buttonPin = 13;
int buttonState = 1;

VarSpeedServo ServoHighHandRotate;
VarSpeedServo ServoHighHandTip;
VarSpeedServo ServoLowHandRotate;
VarSpeedServo ServoLowHandTip;

//*****************************************************************

void setup() {

  pinMode(buttonPin, INPUT);
  ServoHighHandRotate.attach (mainPin1, ServoMin, ServoMax);
  ServoHighHandTip.attach (mainPin2, ServoMin, ServoMax);
  ServoLowHandRotate.attach (mainPin3, ServoMin, ServoMax);
  ServoLowHandTip.attach (mainPin4, ServoMin, ServoMax);
}

//*****************************************************************

//Left Hand (High Hand) rotate clockwise         (180)
//Left Hand (High Hand) rotate anti-clockwise    (0)
//Left Hand (High Hand) tip forwards             (180)
//Left Hand (High Hand) tip backwards            (0)

//Right Hand (High Hand) rotate clockwise         (180)
//Right Hand (High Hand) rotate anti-clockwise    (0)
//Right Hand (High Hand) tip forwards             (0)
//Right Hand (High Hand) tip backwards            (180)



//*****************************************************************

void loop() {

  //buttonState = digitalRead(buttonPin);
  //if (buttonState == HIGH)
  {
    ServoHighHandRotate.slowmove (90, 20);  //All Hands move to centre
    ServoHighHandTip.slowmove (90, 20);     //All Hands move to centre
    ServoLowHandRotate.slowmove (90, 20);   //All Hands move to centre
    ServoLowHandTip.slowmove (90, 20);      //All Hands move to centre
    delay(4000);

    {
      ServoHighHandRotate.slowmove (180, 20);  //Left hand Rotate clockwise
      ServoLowHandRotate.slowmove (180, 20);  //Right hand Rotate clockwise
      delay(3000);

      {
        ServoHighHandTip.slowmove (0, 20);   //Left hand Tip backward
        ServoLowHandTip.slowmove (180, 20);  //Right hand Tip backward
        delay(1500);

        {
          ServoHighHandTip.slowmove (180, 20);  //Left hand Tip forward
          ServoLowHandTip.slowmove (0, 20);     //Right hand Tip forward
          delay(2500);

          {
            ServoHighHandTip.slowmove (90, 20);  //Left hand backward to centre
            ServoLowHandTip.slowmove (90, 20);   //Right hand backward to centre
            delay(1500);

            {
              ServoHighHandRotate.slowmove (0, 20);  //Left hand Rotate anti-clockwise
              ServoLowHandRotate.slowmove (0, 20);  //Right hand Rotate anti-clockwise
              delay(5000);

              {
                ServoHighHandRotate.slowmove (90, 20);  //Left hand Rotate clockwise to centre
                ServoLowHandRotate.slowmove (90, 20);  //Right hand Rotate clockwise to centre
                delay(3000);

                {
                  ServoHighHandTip.slowmove (0, 20);   //Left hand Tip backward
                  ServoLowHandTip.slowmove (180, 20);  //Right hand Tip backward
                  delay(1500);

                  {
                    ServoHighHandTip.slowmove (180, 20);  //Left hand Tip forward
                    ServoLowHandTip.slowmove (0, 20);     //Right hand Tip forward
                    delay(2500);

                    {
                      ServoHighHandTip.slowmove (90, 20);  //Left hand Tip backward to centre
                      ServoLowHandTip.slowmove (90, 20);   //Right hand Tip backward to centre
                      delay(1500);

                      //--------Start of Combined Movements--------------------

                      {
                        ServoHighHandRotate.slowmove (180, 20);  //Left hand Rotates clockwise
                        ServoLowHandRotate.slowmove (0, 20);     //Right hand Rotates anti-clockwise
                        delay(3000);

                        {
                          ServoHighHandRotate.slowmove (0, 20);    //Left hand Rotates anti-clockwise
                          ServoLowHandRotate.slowmove (180, 20);   //Right hand Rotates clockwise
                          delay(1500);

                          {
                            ServoHighHandTip.slowmove (0, 20);   //Left hand Tip backward
                            ServoLowHandTip.slowmove (180, 20);  //Right hand Tip backward
                            delay(1500);

                            {
                              ServoHighHandTip.slowmove (180, 20);  //Left hand Tip forward
                              ServoLowHandTip.slowmove (0, 20);     //Right hand Tip forward
                              delay(2500);

                              {
                                ServoHighHandTip.slowmove (90, 20);   //Left hand Tip backward to centre
                                ServoLowHandTip.slowmove (90, 20);    //Right hand Tip backward to centre
                                delay(1500);

                                {
                                  ServoHighHandRotate.slowmove (180, 20);  //Left Hand Rotate clockwise
                                  ServoLowHandRotate.slowmove (0, 20);     //Right Hand Rotate anti-clockwise
                                  delay(1000);

                                  {
                                    ServoHighHandTip.slowmove (0, 20);    //Left hand Tip backward
                                    ServoLowHandTip.slowmove (180, 20);   //Right hand Tip backward
                                    delay(1500);

                                    {
                                      ServoHighHandTip.slowmove (180, 20);  //Left hand Tip forward
                                      ServoLowHandTip.slowmove (0, 20);     //Right hand Tip forward
                                      delay(2500);

                                      {
                                        ServoHighHandTip.slowmove (90, 20);  //Left hand Tip backward to centree
                                        ServoLowHandTip.slowmove (90, 20);   //Right hand Tip backward to centre
                                        delay(1500);
                                        {
                                          ServoHighHandRotate.slowmove (90, 20);  //Left Hand Rotate anti-clockwise to centre
                                          ServoLowHandRotate.slowmove (90, 20);   //Right Hand Rotate clockwise to centre
                                          delay(1000);



                                        }
                                      }
                                    }
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
8  Using Arduino / Installation & Troubleshooting / Re: /dev/tty.usbmodemfd131 on: October 13, 2012, 06:16:13 pm
Yes female connectors of a sort!!

Thank you for your help and your time, I will have ago at replacing the 16u2, after all if it's already broken I can't do anymore damage!
9  Using Arduino / Installation & Troubleshooting / Re: /dev/tty.usbmodemfd131 on: October 13, 2012, 05:39:22 pm
I'm hoping I'm not being stupid but I guess you need a photo!?

10  Using Arduino / Installation & Troubleshooting / Re: /dev/tty.usbmodemfd131 on: October 13, 2012, 04:27:22 pm
OK so i've connected up the 2 boards, set the first board as a programmer and set the baud to 115200

The result was:

Atmega chip programmer.
Written by Nick Gammon.
11  Using Arduino / Installation & Troubleshooting / Re: /dev/tty.usbmodemfd131 on: October 13, 2012, 12:07:38 pm
ah...my knowledge of these sort of things is limited. I'm sure I can rig up a male-female lead/jumper though and am willing to have a go.

Most of what I have learnt is through forums.
12  Using Arduino / Installation & Troubleshooting / Re: /dev/tty.usbmodemfd131 on: October 13, 2012, 10:16:02 am
I am getting the following when trying - cd Downloads/

cd Downloads/
-bash: cd: Downloads/: No such file or directory

I'm using MacOS 10.8.2
13  Using Arduino / Installation & Troubleshooting / Re: /dev/tty.usbmodemfd131 on: October 13, 2012, 05:28:15 am
I have tried the above but when I type in 'sudo dfu-programmer at90usb82 erase' to the terminal window the response is 'no device present'

Also nothing seems to change when I short out the 2 reset pins.

Could the board be damaged in some way?
14  Using Arduino / Installation & Troubleshooting / Re: /dev/tty.usbmodemfd131 on: October 12, 2012, 03:47:36 pm
Many thanks, I'll give it a go.
15  Using Arduino / Installation & Troubleshooting / /dev/tty.usbmodemfd131 on: October 12, 2012, 11:12:37 am
I have 2 Arduino boards. One is working fine but the other has a flashing light next to 'L' and I can't select the correct serial port (/dev/tty.usbmodemfd131) because it doesn't show up in the list and therefore can't upload any sketches.

Can anyone help?
Pages: [1] 2