i used this code to find acceleration. Tipping the accelerometer 90 degrees to one side should read 9.8
place this code in
void Process_Data_From_Master_uP(void)
Code:
float get_x_value;
float get_y_value;
int a = 205;
float dec_x;
float dec_y;
float x;
float y;
//get analog values for ana04 and ana05
x = Get_Analog_Value(rc_ana_in04);
y = Get_Analog_Value(rc_ana_in05);
/****************************************************/
/*******divide by a(205) to get voltage**************/
/****minus 2.5 to get a range from 2.5 to -2.5*******/
/******multiply by 1000 to get millivolts************/
/*divide by 290 to get G's (290 = millivolts in 1G)**/
/***multiply by 9.803(accelertaion due to gravity)***/
/****************************************************/
get_x_value = (((((x/a) - 2.5) * 1000) / 290) * 9.803);
get_y_value = (((((y/a) - 2.5) * 1000) / 290) * 9.803);
//find and print floating point number
dec_y = ((get_y_value - (int)get_y_value) * 10);
dec_x = ((get_x_value - (int)get_x_value) * 10);
if (dec_x < 0)
dec_x = dec_x * -1;
if (dec_y < 0)
dec_y = dec_y * -1;
printf("acc_x: %3d.%3d acc_y: %3d.%3dr", (int)get_x_value, (int)dec_x, (int)get_y_value, (int)dec_y);
i believe multiplying the (acceleration * change in time) should give you velocity.