DreamForce 2013 Mini-Hack Challenge Project

Dependencies:   ADXL345 USBDevice filter mbed

Fork of df-minihack-slingshot by Doug Anson

Files at this revision

API Documentation at this revision

Comitter:
ansond
Date:
Thu Nov 14 19:32:56 2013 +0000
Parent:
6:446635b12af2
Child:
8:1a26c7f5b2d5
Commit message:
minor updates and tweaks

Changed in this revision

README.txt Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/README.txt	Fri Nov 08 02:34:36 2013 +0000
+++ b/README.txt	Thu Nov 14 19:32:56 2013 +0000
@@ -1,5 +1,13 @@
 Instructions:
 
+VERY IMPORTANT NOTE: 
+
+Please be VERY CAREFUL with the slingshot "bands" - they are easily subject to breaking.
+There is a tunable in the source code called "mouse_scale" that can be used to scale
+the band resistance variation to more easily enable a full "deflection" of the slingshot
+in the game. The band itself will "feel" that it is pretty much fully stretched - please
+DO NOT over stretch the band beyond this limit!  Thanks and have fun!!
+
 1). Complete the “hands-on” exercises first
     - Required to get setup with an mbed account and the compiler environment
 
--- a/main.cpp	Fri Nov 08 02:34:36 2013 +0000
+++ b/main.cpp	Thu Nov 14 19:32:56 2013 +0000
@@ -33,15 +33,6 @@
 // 
 //
 
-// DreamForce2013 TUNABLES START
-
-// maximum angular value of the sling band
-float max_sling_angle = 30.0;
-
-// minimum angluar value of the sling band
-float min_sling_angle = -30.0;
-
-// DreamForce2013 TUNABLES END
 
 // Sling Tunables Start - !!! be careful changing these !!!
 
@@ -54,8 +45,8 @@
 // fire timing threshold
 float fire_timing_threshold = 3.0;
 
-// scaling for mouse movement
-int mouse_scale = 230;
+// scaling for mouse movement - may need to be maniuplated depending on screen resolution to get a full deflection
+int mouse_scale = 250;
 
 // Sling Tunables End
 
@@ -114,8 +105,10 @@
 //        1). Uncomment the debug statement, run the program, and look at raw potentiometer values
 //        2). Determine the min and max potentiometer values you wish to scale to degrees
 //        3). Determine the 90 degree potentiometer value ("median_pot") that denotes the sling band at 90 to the sling body
-//        4). Fill in median_pot, min_pot, max_pot below
-//        5). Compile up and give it a try
+//        4). Guestimate the range of angles you wish to map the potentiometer values (i.e. -x degrees to +y degrees)
+//        5). Fill in min_deg and max_deg below with those angle ranges
+//        6). Compile up and give it a try
+//        7). Additional hint: you may need to modify mouse_scale above to get a full deflection when you stretch the string back.. 
 //
 float potentiometer_value_to_degrees(float val_pot) {
     float deg = 0.0;
@@ -130,9 +123,9 @@
     float max_pot = 0.0;
     float incr_pot = (max_pot*10) - (min_pot*10);       // how many .1 increments we have in the interval [min, max]
     
-    // Mapped degree range: approx [min_sling_angle, max_sling_angle] degrees so convert to
-    float min_deg = min_sling_angle;
-    float max_deg = max_sling_angle;
+    // Mapped degree range: INCOMPLETE: you need to guesstimate the approx angle range i.e. [-x, +y] degrees so convert to
+    float min_deg = 0.0;
+    float max_deg = 0.0;
     float incr_deg = (max_deg*10) - (min_deg*10);       // how many .1 increments we have in the interval [min, max]
     
     // see if we are centered or not