subtract previous variable value from current value


hey guys,
i have 2 variables, angle_x , angle_y, accelerometer. want subtract current value of variable previous value of same variable. tried this,

int x_initial = angle_x ;
int x_final = x_initial - angle_x

but not sure how make angle_x previous value, , x_initial current value. appreciated. thanks.
sr

code: [select]

static int x_previous = 0;
int x_initial = angle_x ;
int x_final = x_initial - x_previous;
x_previous = angle_x;


Arduino Forum > Using Arduino > Project Guidance > subtract previous variable value from current value


arduino

Comments

Popular posts from this blog

VIDIOC_S_FMT error 16, Device or resource busy - Raspberry Pi Forums

using a laptop skeleton to build a pi laptop - Raspberry Pi Forums

Forum for Joomla? - Joomla! Forum - community, help and support