Before u ask yes i'm a freak'n newbee. I've played around with cut and paste and got some of my little projects to work. I need help getting started with writing Arduino code. My project is a Gyro and a X & Y accelerometer that control a servos position and speed.
OK. Here you go:
//Some global variables go here
// Some initialization stuff goes here
// Read the inputs
// Calculate the output
// Send the output
HaHa Thats how simple i wish it was. let me explain my project a little more. 3 analog inputs 1 gyro "G" 2 accelerometers "Z" "X" control 1 servo output. the gyro sets the the nutral point of the servo and tells it how fast to move. Z & X are also used to help set the neutral state when not rotating. I have some code but??????
analog 2: y-axis
analog 3: x-axis
analog 4: gyro
digital 11: servo
created 19 sep 2009
by Russ b. Sutton
modified 26 Jun 2009
// these constants describe the pins. They won't change:
const int gpin = 4; // gyro
const int xPin = 3; // x-axis accelerometer
const int yPin = 2; // y-axis accelerometer
const int sPin = 11; // servo
The problem is you can't start coding until you understand the problem you are trying to solve. Some call that the algorithm.
I can't help you with that, not up to speed with gyros and accelerometers and such. However if you could list steps needed in English or have a math formula, then coding it is pretty simple after that.