I'm trying to piece together a few codes to get what I need because I'm new. One thing that I'm having trouble with is if/ else statements.
Goal: I need a motor circuit to activate when the greatest change in acceleration occurs. There will be two motors. Both will move in one direction at a constant speed. I need one to engage with the greatest positive acceleration in any direction and the other motor the same but negative acceleration. I would like the motor to stay engaged until the acceleration direction changes and the other motor starts.
I'm having trouble figuring out a way to get actual acceleration so I planned on using drastic change in x,y,and z. The device should always move back and forth in the same direction in relation to the device but the device may flipped any way while in use. Would it still operate off the same axis? Is there a way to use amount of change in conditional statements? Is there a way to get a value for acceleration? Is there a better way altogether to achieve same result?
Using Arduino Uno, ADXL345