Using ADXL345 as switch on UNO

I'm new and having trouble finding information on my desired setup.

Plan: HookiŸng ADXL345 to UNO to use as a switch to operate two D.C. Motors. When the ADX moves in one direction activate motor 1 until the ADX stops moving. And when moving in the opposite direction activate motor 2 until the ADX stops moving. Movement is relative to earth and should be less that 1m/s. The orientation may not be constant.

  • I figured parameters could be set so that if one axis remains constant( constant would have to be +- x amount because it may vary slightly) then activate the motors from the other axis or vice versa.
  • Or could set it up so each axis change would activate set of motors and attach the set of motors to all axis.

If need to know what the best way to achieve this would be. A pinout would be great. I'll start hunting down a Code to alter after I get the setup completed unless someone has An idea about the code too. I've been looking for this info but everything I find contradicts the other findings. Most people have setups to record vibrations or control motor speed or position with the accelerometer not just turn it on. Some sketches I find say other hardware is needed and others don't. Any help from anyone would be highly appreciated. If there is already a post with the answers somewhere please just tell me the name. I've looked but haven't found anything. Again thank you.