Code for the sword component of Clash!, a motion controlled pair of input devices for the game Chivalry: Medieval Warfare.

Dependencies:   DebounceIn L3GD20 MMA8451Q USBDevice mbed

Fork of idd_hw3_ddrew73_fil_clashSword by Interactive Device Design

Revision:
1:bb8f49838af8
Parent:
0:a7b02bcbe5fc
--- a/main.cpp	Mon Sep 29 01:52:45 2014 +0000
+++ b/main.cpp	Mon Jun 12 20:02:23 2017 +0000
@@ -115,7 +115,7 @@
             overready = 0;
             overheaded = 1;
             }
-        if (z > 0.35 && totcount <5 && overheaded == 0){
+        if (z > 0.3 && totcount <5 && overheaded == 0){
             upcount = upcount +1;
             totcount = totcount+1;
             }
@@ -127,24 +127,24 @@
             }
         }
     
-    if (phi > 30){
+    if (phi > 25){
         overready =1 ;
         }
     
-    if (theta > 40 && blocked ==0){
+    if (theta > 55 && blocked ==0 && phi > - 20){
         //key.printf("BLOCK!  ");
         mouse.press(MOUSE_RIGHT);
         mouse.release(MOUSE_RIGHT);
         blocked = 1;
         }
 
-    if (theta < -40 && psi > 40 && struck == 0){
+    if (theta < -25 && psi > 30 && struck == 0){
         //key.printf("STRIKE!  ");
         mouse.press(MOUSE_LEFT);
         mouse.release(MOUSE_LEFT);
         struck = 1;
         }
-    if (theta < -40 && psi < 30){
+    if (theta < -30 && psi < 20){
         struck = 0;
         }