Note that he used an MPU6050 which is a different animal than the ADXL335 chosen as the standard motion sensor in this thread. So keep that in mind when trying to apply techniques found in this code.
I do concur that concerning the manner your get data from each module is totally different.
But concerning on how to treat them to obtain the result, it might be the same, from my point of view ;p
I was just giving the principles,that I used and that may remain the same, wathever the module is:
For a swing you want to detect a displacement in space. A simple difference between 2 Quaternion.w do the trick.
For a clash you want to detect a "violent" acceleration/deceleration followed by a "brutal" full stop.
Depending on the module you use and how fast it is able to change state you may need to do several passes throught the loop to detect changes of Magnitude (G force)
[Edit]
To make things clearer concerning Swing detection :
IMUs sucks at detecting change of positions in space. It could be achieved but you may end up with a huge code, and for our arduino device it's not what we want.
IMus are good at detecting acceleration and rotations.
When you play around with your saber, you changes its orientation (in other words, the IMU did rotate around its X/Y axes).
Differences between 2 quaternions are use to detect change of orientation, easily.
The only thing I omited is that you have to test around which axes the blade has rotated : you may don't want to trigger a swing when the saber did rotate along Z IMU's axe (like when Qui-Gon is burying is saber in a massive metalic airlock at the start of Episode 1).
[Edit 2]
While I was typing the last edit, I realized one thing :
a test combining that a difference of 2 quaternions is above a certain value and that an X or Y acceleration is also above a certain value would be even more efficient :
The swing would be triggered only when making "wide" movements.
Hope it makes any sense