Need help making a lightsaber with a MPU-6050 gyro/Accelerometer

I have nearly everything else for the Lightsaber planned out except i want to have the swinging sounds and maybe hit detection. My thought was to have a loop that will keep resetting values to the current positions and when ever they change drastically since the last loop a sound plays.

Is there a better way to do this?

I have no idea how to do the hit detection on the Lightsaber, any help is welcome!

I am using the Y-521 MPU-6050 Module 3 Axis gyro + 3 Axis Accelerometer Module and an Arduino uno.

and when ever they change drastically since the last loop a sound plays.
Is there a better way to do this?

I guess there is only way to found out !!!
Do very small programs/functions that will only do small thingsā€¦
Once you have several simple functions that work, then we can start integrating them in a main loop.

The forum will definitely help you out and will provide advices, but you need to give a first shot at it.

There has been another lightsaber project here.
Might be good to review his code and use it for inspiration ?

dan

For the hit detection a knock sensor may be enough. https://www.arduino.cc/en/Tutorial/Knock

That is perfect for detecting hits!