What does this mean?

I want to replicate what the person has done in the link below. He says that all I have to do is "digitalize it with? an ADC, and send it with servo-pulses to an typical servo". Can someone explain what that means? Explain what I have to do. Offer any links that can hep me understand. Thank you so much for helping me! Thank you :D

http://www.youtube.com/watch?v=flM003C5PIw&feature=related

Fairly simple: he is using an accelerometer (analog output). The angular information is output from the accelerometer, and used to generate a pwm pulse. That pwm pulse is then fed to a servo to control its position.

A better route to go is to buy a Wii nunchuck (it contains a 3-axis accelerometer with digital output).

Do you have any links to the code that can accomplish this? I want to really understand this concept and try it out. I always try learning code from reading it and asking questions about it.

I found this code:

#include <Servo.h> 
 
Servo myservo;  // create servo object to control a servo 
                // a maximum of eight servo objects can be created 
Servo myservo1;
Servo myservo2;
  
const int xPin = 0;
const int yPin = 1;
const int zPin = 2;

//The minimum and maximum values that came from
//the accelerometer while standing still
//You very well may need to change these
int minVal = 262;
int maxVal = 402;

//to hold the caculated values
int x = 0;
int y = 0;
int z = 0;

void setup(){
  Serial.begin(9600);
  myservo.attach(9);
  myservo1.attach(10);
  myservo2.attach(11);
}

void loop(){

  //read the analog values from the accelerometer
  int xRead = analogRead(xPin);
  int yRead = analogRead(yPin);
  int zRead = analogRead(zPin);

  //convert read values to degrees -90 to 90 - Needed for atan2
  int xAng = map(xRead, minVal, maxVal, -90, 90);
  int yAng = map(yRead, minVal, maxVal, -90, 90);
  int zAng = map(zRead, minVal, maxVal, -90, 90);

  //Caculate 360deg values like so: atan2(-yAng, -zAng)
  //atan2 outputs the value of -? to ? (radians)
  //We are then converting the radians to degrees
  x = RAD_TO_DEG * (atan2(-yAng, -zAng) + PI);
  y = RAD_TO_DEG * (atan2(-xAng, -zAng) + PI);
  z = RAD_TO_DEG * (atan2(-yAng, -xAng) + PI);

  //Output the caculations
  Serial.print("x: ");
  Serial.print(x);
  myservo.write(x);
  delay(15);
  Serial.print(" | y: ");
  Serial.print(y);
  myservo1.write(y);
  delay(15);
  Serial.print(" | z: ");
  Serial.println(z);
  myservo2.write(z);
  delay(15);

  delay(100);//just here to slow down the serial output - Easier to read
}

This controls three servos, but I want to only control one servo like in the video.
How to I get rid of the extra code that controls the other servos?
Can you edit it… please? (cherry on top) :smiley:
I really need help, this will get my whole project working!
THANK YOU SO MUCH!

How to I get rid of the extra code that controls the other servos?

Use the delete key.

I always try learning code from reading it and asking questions about it.

It doesn’t seem too difficult to recognize what portions of the code deal with the three servos.

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

Servo one is called myservo. Servo two is called myservo1. Servo three is called myservo2. Stupid names, if you ask me, but I didn’t pick them.

What axis is he using in the video? X? Y? Z?

What axis is he using in the video? X? Y? Z?

That would be my guess.

Does it really matter? Pick one. If that does not produce results you like, pick another one.

You are trying to learn something from this, aren’t you?

If not, just contact the video poster, and try to buy his creation.