DreamForce 2013 Mini-Hack Challenge Project
Dependencies: ADXL345 USBDevice filter mbed
Fork of df-minihack-slingshot by
Diff: main.cpp
- Revision:
- 9:3af90289b117
- Parent:
- 8:1a26c7f5b2d5
--- a/main.cpp Thu Nov 14 19:34:36 2013 +0000 +++ b/main.cpp Tue Nov 19 01:21:46 2013 +0000 @@ -33,7 +33,6 @@ // // - // Sling Tunables Start - !!! be careful changing these !!! // stretch start threshold @@ -61,7 +60,7 @@ // Physical interfaces USBMouse mouse; ADXL345 accelerometer(p5, p6, p7, p8); -AnalogIn stretch_sensor(p15); +AnalogIn stretch_sensor(p16); BusOut leds(LED1, LED2, LED3, LED4); // Potentiometer @@ -117,7 +116,7 @@ // DEBUG - may need this to calibrate pot values below //std::printf("Raw pot value=%.1f\r\n",val_pot); - // Potentiometer range: INCOMPLETE: you need to uncomment the print statement above and determine median_pot, min_pot, max_pot + // Potentiometer range: typically about [36.8, 80.6] with 56.0 being "median_pot" float median_pot = 0.0; float min_pot = 0.0; float max_pot = 0.0; @@ -260,6 +259,9 @@ // DreamForce 2013 Challenge: Adjust the angle to account for the relative angle between the sling and the slingshot body angle = adjust_for_sling_angle(angle); + + // DEBUG + //std::printf("stretch=%.1f angle=%.1f\r\n",stretch,angle); leds = state; @@ -304,4 +306,4 @@ // wait for 100ms wait_ms(100); } -} +} \ No newline at end of file